Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Embed Lots Of Html Code In Php & Construct Objects In Php


I have a php file, it contains just a few php codes. The php codes I
need to use is to construct an object, and use it several times, from
html head until the last line of html code.

I know I can construct the same object (I am using php5) several
times, something like $object = new $class, and use several <?php
$object->functionX ? ... <?php $object->functionZ ? to include
php code in html code.

However, to construct this object I have to call a remote server, and
rely on its response, which is a bit slow. To construct it several
times takes even more time, and I do not like that.

So my questions are :

1) How can I embed a big chunk of html code in php without using
something like echo "<a href="aaa.html">" all the time

2) Can I just construct an object one time and use it in different <?
php ... ?blocks?




View Complete Forum Thread with Replies

Related Forum Messages:
Embed A Php Code Into Html
I want to embed a php code into my html file. But its not showing anything. The same code works when I rename the file as .php

<html>
<body>
<?php echo "hi";?>
</body>
</html>

This code works as hi.php3 but doesn work when I rename file to hi.html.

View Replies !
How These Forums Construct Html Files...?
how do these forums output .html files for threads? Im guessing that they use mod_rewrite to change the querystring to f5/34343.html - but how do they actually output html pages? I would like to do this on my own forums, and they use vbulletin as well.

View Replies !
Embed Php Generated Html In Another Html Page
I am trying to include some php generated html in a page that is just a standard html file, NOT a php file. I have seen other html pages do this by including an src to the cgi script in script tags, like this:

<script src="http://someurl.com/somescript.cgi"></script>

the html page loads and the script is executed and the returned html is displayed in the calling page. So, I tried this:

<script src="http://someurl.com/somescript.php"></script>

It doesnt work!!

View Replies !
Embed Php Code In A Cgi Script
I have a form on a php site and I'm trying to send the information filled out in the form to an email address, aswell as sending the email I also want to display a thank you page. However I want the thank you page to be in php with includes and so on. So my question is how do I get a cgi to recognise php commands?

View Replies !
Function With Many Vars Or Lots Of Redundant Code?
What would be worse speed-wise:
1 - function with 20 input variables and 20 return variables.
2 - running the same 100 lines of code in 3 different places with minor changes to said 20 variables.

My specific problem: I need to run up to three queries depending on a certain piece of dynamic data. The output of the queries varies widely, but the html framework to display the data is for the most part identical. So I need to be able to execute the html for each query individually.

Should I just copy and paste the html framework into each query's while loop? Or should I put the html framework inside a function, and put the call to the function in the while loop? Does that make enough sense?

View Replies !
Embed Language Strings Into Javascript Code
I am using language files to localize my script. For example, I include lang_english.php that holds the english language strings like:

define("_WAIT","Please Wait...");
define("_ERRORNAME","Please enter your name");

Then use the defined string in my scripts like

echo _ERRORNAME;

As fas as PHP scripts are concerned, everything works fine so far. But, I can't localize my Javascript codes. For example form error alerts. I include my javascript files externally in my header.php, like Code:

View Replies !
Html Embed Editor?
I ve coded a CMS which also allows the administrator to write custom php modules that get stored in the database. Those modules are called in the frontend with eval(). It works great.

The problem, is that the only way i can edit the module is on a big textarea. and its not very nice to code in there. Does anyone know any html embed php editor?

View Replies !
Putting Lots Of HTML Into A Function?
is it possible to print out or store multiple lines of HTML using a single variable or print statement? Example: I have the following html

<HTML>
<B>Hello</b>
</HTML>

how can I print that out without doing: PHP Code:

View Replies !
Embed PHP Script In HTML Page...
The first page of my Internet website must be INDEX.HTM. But, if I want to embed some PHP code in this page, I must rename it to INDEX.PHP. Easy, but not simple, because INDEX.PHP will not load as the default startup-page of my website.

So, my question is:

How can I embed some PHP code within a normal HTML page (without using the
..PHP extension)?

View Replies !
Complex Forms With Lots Of Different Field Types And Lots Of Validation.
i started with a newsletter signup, and eventually made more complex forms with lots of different field types and lots of validation. So i havent got into "strings" yet. ( i can hear the laughter from here). Code:

View Replies !
Returning HTML As Word, How Do I Embed Images?
I'm sending html content to the client computer as "application/msword" using the following code (see further down): Is it possible to embed images in $docContent so it will be accessible in the client computer if he:

1. Saves the downloaded doc and.
2. Laiter open the document without being online?

example code:

View Replies !
Use Cache_Lite To Cache Lots Of Small Pieces Of HTML
I want to use Cache_Lite to cache lots of small pieces of HTML, results of function calls, XML returned from web services, etc. But how can I manage the disk space used for caching? Do I have to set up a job for this?

View Replies !
Script That Can Take A Folder With A Lots Of Subfolders In It And Make Html-pages Of It
I wonder if anyone knows if there is a software or script that can take a folder with a lots of subfolders in it and make html-pages of it. I have a lot of free softwares organized in a lot of folders and would like to put them on a webserver and in the same categories as I have them in the folders.

View Replies !
DB Access Objects VS Full Code
I was wondering if there is any difference in performance between using DB access objects and standard DB access code. Reason I'm asking is I believe each object takes a piece of memory and if I have a site that gets huge traffic and is heavily populated with DB info wont it burn through the server memory rather fast? For example I use this type of structure in a lot of my programs to perform queries on the DB’s. PHP Code:

View Replies !
Javascript /CSS Code Accessing DOM Objects Introduced Via Include
What I'm ultimately trying to achieve is use Javascript to access the DOM objects of any given page within the web site I'm building to dyanamically resize any and all text elements.

I have Javascript some code that works perfectly when used in isolation via a flat XHTML page however it's when I try to use that same code in PHP rendered pages where the content derives from a PHP include, that problems arise and it just doesn't appear to work at all. Code:

View Replies !
Wnat To Embed Full HTML Page In Email, But Migrating Style From Css Files To Element Style Attributes
My web pages of course use css files, but Webmail services require
style to be in element style attributes.

How do I convert a standard HTML page to HTML suitable for delivery to
webmail services?

Perhaps another way to ask the question is:

How to I walk the DOM and for every element, for every style, set the
element's style attribute to the values that are looked up in the css
file in normal rendering.

Anyone know of any tools, or examples to do this?

View Replies !
Inserting Adsense Code - Html Program That Automatically Coverts All My Text Files To Html Webpages?
I've purchased a text to html program that automatically coverts all my text files to html webpages within a template, but the only problem is how do I insert my adsense code into all 250 pages? I've seen articles regarding PHP includes for page templates, but I'm not sure how this would work inserting my code.

View Replies !
Loop Construct
I've fallen back to beginner level, get this script to display all the months involved. I'm querying the months and years from a database, ie field Months with values 1 thru 12 and Years, values 2001 thru to recent year. Perhaps not the ideal setup but not able to change it easily.

<HTML>
<HEAD>
<TITLE>Display each month from stat month,stat year to tomonth,toyear</TITLE>
</HEAD>

<BODY>
<?php
$tomonth=2;
$toyear=2004;

$stat_start_month=10;
$stat_start_year=2002;
..................

View Replies !
Ltrim In While Construct
I am using this code:

while ($element = each($name))
{
ETC
ETC

I need $name to be left trimmed. HOW DO I nest ltrim inside the each function inside the while brackets? ltrim has to execute on each iteration - but the following code snippet doesn't work:

while ($element = each(ltrim($name, $dir)))
{ ...

View Replies !
Using Database Objects Within Other Objects. Inefficient?
I've defined a Database class with methods to call mysql_query(), etc. The connect() method makes a persistent connection. I've also defined a Member class to hold functions and data for users. PHP Code:

View Replies !
Construct A Mail Service?
is it possible to let a particular user to when registering on www.domain.com, he /she will get a email address inherited from the domain like herusername@domain.com?? Can PHP construct this service?

View Replies !
Failing Elseif Construct
Can anybody see anything wrong with this:

<-- snip -->
// some other ifs and elseifs that seem to work okay

elseif ($CH_address_same != 1)
{
if ($PayMethod == "credit" && empty($CH_Address1)
|| $PayMethod == "credit" && empty($CH_City)
|| $PayMethod == "credit" && empty($CH_Zip)
|| $PayMethod == "credit" && empty($CH_Country))
{
$err = 1;
}
}

The CH_address_same variable is being posted to the server using a checkbox
with a checked value of &#391;'.

For some reason if the first clause returns true the second clause chokes?
I can't see why. But I am a beginner!

View Replies !
Child Construct Parent
I'm building out a OO based app in PHP 5 but I'm getting a little
confused on children contructing parents.

I have a parent that looks like this:
abstract Class State {
protected $database;
protected $user;
protected $output;
public function __construct($database,$user,$output) {
$this->database = $database;
$this->user = $user;
$this->output = $output;
}
}

And a child that looks like this:
Class Status extends State {
public function __construct($database,$user,$output) {
parent::__construct($database,$user,$output);
}
}

This seems to work OK. But I'm getting confused when thinking about
adding a new child who then has to contruct the parent again. Isn't
this getting away from the whole purpose of inheritence? It seems like
this is recreating the parent with every new child that come along.
Would it be possible to just have a single instance of the parent that
all children extended or am I missing the point here?

View Replies !
Construct Name Of Variable With Variables
this might sound strange,
but to construct a name of a variable:

i have these vars (and loads more):
$menu_ho = massageMe("$string_1");
$menu_do = massageMe("$string_2");
$menu_co = massageMe("$string_3");

they stand for some massaged strings, which are
displayed as a body title.
i also have a page called in the url like "site.php?pg=home"
what i want is to do is:

$constructed_var = $menu_$pg

so if the page is home i want to get $constructed_var = $menu_ho.

View Replies !
How To Construct A Test Harness
In my never-ending search to accomplish my projects more efficiently, I'm trying the "modular" approach - not object oriented, but just "plug-in" procedural modules that would execute a specific and project-specific chore.

For example, I've been building a back-end hotel reservation system (for ever!) which needs to allow the display and editing of - how many rooms are open and reserved (one module), a check-in/check-out date picker (another module), an editable credit card info display (yet another module) - etc. The "editing" aspects of each of these modules all need field validation routines as well.

I'm happy with what I'm doing so far as I've got each task split out into a specific piece (module), but the way I've been testing these modules up to this point is when they're all "included" in a called page which is getting quite tedious.

What I'd like to do during the development phase of any given module, is to "plug" it into a kind-of test-harness, if you will. This harness would provide the variables I need for that particular module and then give me an output display of the result/submit so I can easily check what I'm getting from my code and tweak/correct accordingly.

I'm happy to write my own test harnesses for each module (as I don't want it to get too complicated and time-consuming), but can anyone advise on the "best" - and simplest - way this can be done?

View Replies !
Construct MySQL Queries
I am having trouble with MySQL and PHP. I want to do neat stuff in PHP but I have trouble generating commands and stuff. I was wondering if there is any visual tool that can help me contruct PHP and MySQL codes.

View Replies !
Construct Links From IDs Of Database
There is a recordset that is output to a page after the user searches. I have an icon that needs a link on it. This link will send them to an edit page. All of the information needs to be transferred from that particular record. Now all of my id #'s are stored in a variable called id. Any ideas how to construct the link.

View Replies !
Construct A Nested Multipart Mail
I used pear api to make this mail but I can t add multipart.My mail
structure is like that.

part 1: a file
part 2: multipart
part 1: a file
part 2: a file

Content-Type: multipart/related; boundary= ...

View Replies !
Warning: SoapClient::__construct() [function.--construct]:
I try to use a webservice over https with the PHP5 SoapClient. I get following warnings:

Warning: SoapClient::__construct() [function.--construct]: failed to create an SSL context in E:IntranetSkriptsparkinginc_func.php on line 330

Warning: SoapClient::__construct() [function.--construct]: Failed to enable crypto in E:IntranetSkriptsparkinginc_func.php on line 330

Warning: SoapClient::__construct(https://test.xxxx.at/sepws/services/xxxxWS) [function.--construct]: failed to open stream: No such file or directory in E:IntranetSkriptsparkinginc_func.php on line 330

Code:

View Replies !
Html Code Within Php Code
How can I insert HTML code from within a php statement?

eg

if validation
{
html code snippet to display message
}else{
HTML Code snippet to display error page
}
}

View Replies !
HTML To BB Code
How do I convert HTML code to BB Code, primarily the [img] tag and the [url] tag. Here's the code I tried which doesn't seem to work (both [img] and [url] codes are below). PHP Code:

// [IMG] Code
$new_post = eregi_replace("[img]([^[]*)[/img]","<img src="1" border="0">",$new_post);

// [url] Code

I just realized that I don't even have the [url] code anymore.

View Replies !
HTML Code
code that is working

echo'

<input type="button" value="view" onClick="top.location.href= select_product.select.options[select_product.select.selectedIndex].value">'

i want to add target=_blank in the end so that url will open in a new window however i keep trying using different with different ' or ".

View Replies !
Construct A Dynamic Navigation That Expands When A Visitor Selects A Sub-directory.
I am trying to construct a dynamic navigation that expands when a visitor selects a sub-directory. The site has 6 sub-directories, plus the root. Is there a way to use a wildcard or something, to indicate all contents of a directory?

For example (this does not work):

<?if($_SERVER['PHP_SELF']=="/cars/*"){?>

Anyone know of a solution? What about the root level, is there an option for that too?

View Replies !
HTML With PHP, How I Can Add PHP-code In HTML...
Could you help me. How i can add my PHP script or PHP- code in HTML-file.

View Replies !
Parse PHP Code In .html??
I was wondering if it's possible to parse PHP code in .html documents without requiring root access (since I'm on a virtual server). I want to make a two line call to a log program, but I don't want to have to change all of my .html files to .php.

View Replies !
HTML Code In Eval
I'm currently trying to put some HTML code into a variable and to use
it later.
Any ideas, why TEST1 in the following example displays a link, while
TEST2 only displays a text?

<html>
<head>
</head>

<body>

<!-- TEST1 -->
<a href="www.test.com">this is test1</a>

<br><br>

<!-- TEST2 -->
<?
$teststr="?><a href="www.test.com">this is test2</a><?php";
eval($teststr);
?>

</body>
</html>

View Replies !
HTML Email Can Only See The Code
I create a PHP script like the following to send a form output, but only the html code is shown in the html, really can't find any mistake:

<?
for ($i=0; $i<count($uniEmailArr); $i++) {
$to = stripslashes($uniEmailArr[$i]);
$subject = "testing";
$body = "<b>test</b>";
$headers = "From: Marketing <mktg@co.biz>";
$ret = mail($to, $subject, $headers, $body);}?>

Returns only a message with the body as below: (only subject is correctly inserted in the email) <b>test</b> From: Marketing <mktg@co.biz>

View Replies !
Put HTML Code From A File
How can I put HTML code that is in a file PHP have any funtion or I have to do it?

View Replies !
Embedded HTML In Php Code With 5.1.1
why this code works in 4.X, 5.0.X and not in
5.1?

<?php
function myfunction(){

*** php code ***
?>
<a href="bla.bla">bla</a>
<?
*** php code ***

}

?>

when i run it under 5.1 i get the error "Parse error: syntax error,
unexpected $end in" on the last line of the file. i drop the embedded
html and it works fine.

i know doing it this way is kinda sloppy and on my list of things to
fix, but that can't be done right now. is there some setting in 5.1
where i can turn this back on or do i have to downgrade to 5.0 again.

View Replies !
Color The PHP Code Into HTML
I have a website source code website. I want my code in HTML page is colored as standard color syntax. Are there anytool that can help me in this problem. For ex: My code is

<?echo "something";?>

I want the code in HTML looks colorful like:

<?echo "something";?>

Ofcourse, I can change the color manually, but I have tons of code and dont want to do it by hand.

View Replies !
Html Code From Folder
How can I write a php code that when it is include in a html page it
create a menu link automatically, reading from a main folder its
subfolder and html files?

View Replies !
Embedding Php In Html Code?
I'm a new boy to php and working on a web site with long sections of
code that could be done as includes apart from one or two things
changing.
I've tested the following and it works, but what I really want to know
is am I OK placing php code inside a html line like this, or could there
be problems?

<!-- html code for test.php -->
<!-- lot of code cut -->
<a href="<?php print $filename; ?>"><?php print $title; ?></a>
<!-- lot of code cut -->
<!-- end of test.php -->

<!-- which is called in the main file like this -->
<?php
$filename="index.php";
$title="Index Page";
include ("test.php");
?>

View Replies !
HTML Forms Within PHP Code
i want to do is put an "HTML form" from a PHP code, how do i do this ?? is there a way to do it? Code:

View Replies !
How To Get HTML Code Of Another Page
Can someone direct me to a code that will go to another page and retrieve the html source for parsing within a php script?

View Replies !
HTML CODE IN GMAIL
I have html generated code:

like

<table><tr><td><img src="http://www.abc.com/images/abc.jpg"></td></
tr></table>

When i copy above code and paste this code in gmail,yahoo or hotmail compose mail. But when i send mail with this code i received html code not display image in table format.

I want to accept this html code and display in html structure in mail without use of any server side scripting language.

View Replies !
Add Html Code Using Fwrite
I am just trying to put together a little "newsboard" script for a site. I have created my form, which contains 4 different fields, however i want to create a html page from the fields of the form. However, i can't seem to figure out how to put the html code and variables into fwrite($fp, $string); in order for all the fields to complete a page that the script is creating. Essentially right now it is creating a blank page.

View Replies !
Hiding HTML Code
I came across this site looking for a solution to this menu I've been trying to do with php. They way I wanted it to work was this:

<!--- page.php ---->

<a href=page.php?submenu=1>

<?php if($submenu!=0) {>
<tr>
<td>put sub navigation here</td></tr>
<?php }?>

As you can see I just want to pass the boolean to the same page, so that it changes the value of a $submenu. I'm still unfamiliar with developing, but maybe I should be using javascript or other language, I really don't know.

View Replies !
Echo Html Code
I would like to echo HTML code and not execute it, how can i do that.

Example : echo('<br>') would not print a line but "<br>" on the screen.


View Replies !
Grab URL Out Of HTML Code
Basically I have an HTML page with some text and URL's. I need to create a script that will grab the source code and grab the links on that page. Now the pages I use it on use graphics for buttons and I need those URLS too. How can I do this?

View Replies !
Html Code In Echo
i try to put this working but in some point it incorrect, i try 2 different ways, the code is: PHP Code:

<td>
<?php echo "<input type="button" name="refererEditBtn" value="Edit" class="form" onClick="frmAllowedReferers.refererBtnIDName.value='".$line."' frmAllowedReferers.refererBtnValue.value='Edit' frmAllowedReferers.submit();">"; ?>
</td>

or

<td>
<?php echo "<input type='button' name='refererEditBtn' value='Edit' class='form' onClick='frmAllowedReferers.refererBtnIDName.value='".$line."' frmAllowedReferers.refererBtnValue.value='Edit' frmAllowedReferers.submit();'>"; ?>

</td>

View Replies !
Strip Html Code
I have a mysql database and I am building a search engine on it. The problem is that in the database there is stored html code like , <align> so it messes up my result page. Is there enything I good do. Some php fuction? I have tried htmlspecialchars() and htmlentities() and there decode modes but nothing seems to happen.

View Replies !
Ereg_replace With Html Code
I'm writing some php code which parses an html file and formats it. I'm having a few problems using the ereg_replace command to strip out some html code. My code is as follows:

<?
$final = ereg_replace("<INPUT TYPE="checkbox" NAME="action_chk_lst[[0-9]]"", " ", $strip2);
?>

$strip2 is the html file contents. The file contains several instances of the above string and action_chk_lst shows up as action_chk_lst[1], action_chk_lst[2], action_chk_lst[3] and so on. My regular expression doesn't seem to match as the html code isnt removed once it's run. Using str_replace and referencing one of the action_chk_lst's specifically works fine (the code is removed and replaced with a space)
Any ideas as to why it's not working, and/or is there a better way to do it?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved