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.





Require_once(<html Fragment File>) Vs Document.write(<html Fragment>)


To reuse common fragments of html on many pages I have used javascript functions, called from a linked .js file, which are precisely one instruction: document.write(<the html>).
I'm starting to learn PHP now and see that a require_once(<url for file containing the html fragment>); will have the same affect.

My question is, which method is more efficient? i.e. renders faster?

P.S. is there a simple way to set up testing-only server-software on my local machine so i can debug php locally before uploading them to site's server?




View Complete Forum Thread with Replies

Related Forum Messages:
HTML Document
i need to create a form that, when submitted, will add data to the bottom of a table. the table is at <removed> on the results page. i can work out how to do the form that submits the data, but i have no idea how to make it edit the actual results document.

View Replies !
URL Of Referring Html Document
I am using this code to retrieve the current URL:

function selfURL() {
$s = empty($_SERVER["HTTPS"]) ? ''
: ($_SERVER["HTTPS"] == "on") ? "s"
: "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? ""
: (":".$_SERVER["SERVER_PORT"]);
return
$protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
}
function strleft($s1, $s2) {
return substr($s1, 0, strpos($s1, $s2));
}

which returns the URL of the current PHP script.

But, I would like it to return the URL of the html page that preceeded
this script.

I mean, I have a some html pages with some photos. I have a form that
allows users to enter an email address that will then send the link of
that html page to the email address used.

When I use the above it only shows the address of the page that
executed the command, not the original html document.

View Replies !
Parse A Html Document
Anyone have any ideas how to parse a html document.

I am trying to extract out specific information from the page.
Also, what do you do if the page is dynamic (e.g. a cgi generated page) how
do you find it?

View Replies !
Saving A Html Document
Currently my php produces a bill which my users can read but this is a dynamic php document and it works fine until a whole month goes by and they are a bit slow in paying.

The next time they view the page it has two months quantity on instead of the one and I have got round it but I would prefer to have one bill per month.

Could I save the html file (without any php) that is output into a file which could rest on the server until called?

I have been trying to do this with a @copy($file, $path.$newfilename); but on reading other entries in this form I am wondering whether an fput would be better ... and what is the difference?

View Replies !
PHP Script To Be Loaded In Html Document
I have a PHP script that I want to impliment direct into an HTML template where the file is FileName.htm - containing a PHP scipt. Is this possible?

View Replies !
How To Convert Html To Pdf And Print The Document
I need to know how to convert html to pdf and print the document with
different paper size?

View Replies !
Sending A Html Document Using Mail() Function
I need to send the following code in an email...but its a mix of php and html, and it retrieves various values from a database before sending...oh and i wouldnt mind the sending of the mail to be done on a button click!...anyways i have messed and messed but i aint too sure whether it can be done! Can someone please tell me the code and where i need to place it within my code? Code:

View Replies !
View Document File Into Html Format
This is to view the document file into html format. Code:

View Replies !
Sending Php/html Document As An Email Using Php Mail() Function
I need to send the following code in an email ... but its a mix of php and html, and it retrieves various values from a database before sending...oh and i wouldnt mind the sending of the mail to be done on a button click!;)...anyways i have messed and messed but i aint too sure whether it can be done! Can someone please tell me the code and where i need to place it within my code? .....

View Replies !
Remove All The White Spaces In Your Final HTML Document.
When you are coding in HTML or CSS, you want to remove all the white spaces in your final HTML document. All the spaces, carriage returns, tabs etc.

The white space is just "noise" and is not displayed by the browser. Removing it will not have any impact on what is shown in the browser.

Reducing white space will make the filesize a lot smaller, be quicker to download for your visitor, be take up less bandwidth when your site is crawled. It increases the content:markup ratio, which is good for SEO purposes. Code:

View Replies !
Write From Xml To Html
I am trying to pass some data from xml to table in html. Browser do shows the data but it always keeps first row empty.

View Replies !
Wanted - Simple Section Numbering Prog For HTML Document
I maintain various specs and FAQs in manually edited HTML documents,
and I'd very much like some simple way of automatic section numbering
as in 2.1, 2.1.1, 2.1.2, 2.2 etc, with table of contents generation
plugged into the start of the document so that each section can be
accessed via a link (and also maybe automatic footnote numbering). Code:

View Replies !
Write To Html File
I was wondering if anyone can point me in the right direction or maybe post an example of what I need? I need to be able to have a html file that I write to (which I know how to do), but I need it so that it keeps the previous information in the file, while the user adds more.

View Replies !
How Do I Write This Html From A Database?
I have a small database "Database.txt", each line of which looks something like:

rv001,Some More Cities,112.00,OK,*1R: Paris*2_4R: London*4_6R: New York*8R: Moscow*10R: Rome*,

I use a bit of php code to find an entry like the one above "rv001", and print an element of it out, like so: Code:

View Replies !
Write Html Source To A File
How can I use a php script running on my web server to read in the
html source from an arbitrary webpage and then write it to a file on
my web server?

View Replies !
Write Html Code To Another Php File.
im having problems writing to a file - What i want to do is to is write html code to another php file. PHP Code:

View Replies !
Upload Photo / Write To Html
I've been looking for a script -- PHP or Perl -- that will allow a person to upload a single photo via their browser and write the photo <img src> on the fly to an html page.

There are of course many gallery type thumbnail scripts, but it's been nearly impossible to find one that will do the following after the user arrives at the script's online form page:

-- first they give the html page a unique name, ie, vacation.html

-- they next type in some text describing the photo that will be seen at vacation.html

-- then they navigate to the photo on their harddrive via a "Browse" button

-- click submit ==> the photo is uploaded and a page is generated called vacation.html with some text and the picture.

Ideally such a script would have a config file that would allow the site owner to identify exactly which folder the images will go into; which folder will hold the html pages; the images could be of varying dimensions however a limit could be put on the maximum file size of each photo (for ex, 1 MB); only .jpg, .png, or .gif files would be allowed; and an option could be selected as to whether to permit overwrites.

View Replies !
Write To Html To Bring Down Queries
I would like to write my pages to html files and only update those files when I execute the write again. But im not sure how to write them to file. I thought of executing wget and use that but that seemed like alot more work then it should be. Any ideas?

View Replies !
Document.write(document.referrer)
Anyone know how I can use this java statement:
<Script Language="JavaScript"> document.write(document.referrer)</SCRIPT>

in the following php email message? PHP Code:

View Replies !
PHP Does Not Write Full HTML Code Randomly
When writing an HTML table after a PHP database query very
occasionally (1 out of ten times -- same code) the HTML page is
truncated and cells/or full final rows of table are missing. Looking
at the page source the code is truncated at some final point at the
end.

I load records in an array through a loop and then use another loop to
render the html with embbeded php array variables to draw the html
table.

I thought this could be related to cache or may be solved using flush
function??

I come from ASP and never happened in ASP code.

View Replies !
Fppen------ How Do I Get Permission To Write To A Html File?
I can write to this textfile:

$fp = fopen("./testfile.txt","w");

but not this html file:

$fp = fopen("./testfile.html","w");

How do I get permission to write to a html file?

Windows XP, IIS localhost

View Replies !
How Is It Posible To Write IP Authentication Program In My Web Page (HTML)
How is it posible to write IP authentication program in my web page (HTML)?

View Replies !
Javascript Document.write
code: HTML Code:

<html>
<body>
<?php
<script type="text/javascript">

document.write("hello");

</script

echo 'jamie'

?>
</body>
</html>

View Replies !
How To Read And Write Into A Word Document
I am working on a recruitment site and in that we have an option of cv upload. Either text, or word couments (.doc or .rtf) are allowed. I am able to upload the file successfully, but when I try to read that file and try to show in a textarea field I see some junk characters also getting displayed. Can anyone tell me what function should I use to suppress that junk and show only the text?

What I am doing is open the file in read mode, read the entire contents of the file and display it.

View Replies !
Write A Function That Will Read In A Text Document
I'm trying to write a function that will read in a text document containing various bespoke tags which I then expand into the appropriate HTML. I've done most of them but was wondering if someone could help me with this particular one .. I'm guessing I should be using preg_replace but can't seem to get it to work.

I have a variable called $rec_id which is an integer. The following is the conversion I want to perform: Code:

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 !
PHP HTML Email Doesn't Format The Text Using The Html Tags
I had a PHP script that sent an html email from a Flash form. It was all working on a Windows based server. Then my server was switched to a Linux based one. It now sends the email, but has a lot of random characters and doesn't format the text using the html tags. Code:

View Replies !
Can't Get Apache To Run PHP Inside Html From Localhost - Works Fine From /var/ww/html
I had a look at the stantonfinley fedora core 5 instructions and robooted but to no avail. PHP scripts work fine from var/www/html whether the suffix is .php or .htm but not from localhost. Code:

View Replies !
HTML Email Using PHP Problem (Receive Html Tags)
When I send the html email, the only thing I receive is the tags (the
html codes basically). I want to be able to see the email like a html
page, what is wrong with my code? Here is a copy paste of it.

$HTML = "</html><body><img src='http://www.somewebsite.com/
someimage.jpg'></body></html>";

$headers = "From: $from
";
$headers .= "MIME-Version: 1.0
";
$boundary = uniqid("HTMLDEMO");
// Now we attach the HTML version

$headers .= "--$boundary
".
"Content-Type: text/html; charset=ISO-8859-1
".
"Content-Transfer-Encoding: base64

";

$headers .= chunk_split(base64_encode($HTML));

mail($to,$subject,"",$headers);

print "mail Sent<br>";

The email I receive has this as text:

</html><body><img src='http://www.somewebsite.com/someimage.jpg'></
body></html>

View Replies !
P3P Compliant, Still Can't Read/write Cookies From IFRAME As 3rd Party Document
I have two sites, both with valid P3P policies that passed the W3C P3P
validator, including the P3P compliant HTTP headers test.

On one of the sites, Site A, I have a web page that loads a document from
Site B in an IFRAME. In this context the web page on Site A is the
"originating" document and the web page on Site B is a 3rd-party document
(since it's from a different domain). I thought that having a valid P3P
policy would make IE6 in the default Medim setting, allow cookies from my
IFRAME document from Site B, but apparently it still does not. I am getting
the dreaded "red-eye" and the document from Site B can't read/write cookies
while in the IFRAME.

Is this correct, that you can't read/write cookies from an IFRAME as a 3rd
party document, even if you have a valid P3P policy that indicates no PII
(Personally Identifiable Information) is collected? Or can I fix this
somehow?

View Replies !
RemoveHandler .html .htm (parse Php In .html Files)
I want to parse php in .html files.

I put this in .htacces file:

RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

Its work, but some of my php aplications have urls:

www.mysite.com/this-is-page

without .html in the end

how to parse that? Which code I must use.

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 !
.html' Page Be Replaced By '.html.php'
Can a '.html' page be replaced by '.html.php' page via RewriteRule? To clarify, I'm using a software that formats the look of the site using .html pages. I'd like to add PHP code to that page but of course, it is not of the right page type.

What I was wondering is Could I create a duplicate of that '.html' page, rename it to .g. '.html.php' and make the revisions and then just create a RewriteRule that redirects the '.html' page to the '.html.php' without generating an error?

The alternative and undesired way of doing it would be to rename the original page to '.html.php' and find and revise ALL of the routines that call that page. That would create a revision nightmare especially upon upgrading the software.

View Replies !
Html Within Works, But Within Html Doesnt
Below are two different ways of writing the same script. The top one works
but the bottom one displays nothing in the list. Code:

View Replies !
Use Of #fragment With SID
I just added session support to a web site and the URL's that contain a
#fragment no longer function. Is there a delimiter that I can add following
the #fragment that will tell the browser that the SID information is not
part of the #fragment?

View Replies !
DOMDocument Thinks "<html></html>" Has Two ChildNodes?
I'm trying to mess around with PHP5's DOM functions and have run into
something that confuses me:

<?php
$dom = new DOMDocument();
$dom->loadHTML('<html></html>');

echo $dom->childNodes->length;
?>

Why is the output 2? Shouldn't it be 1?

View Replies !
Fragment Data In Mysql
i just wondering if there is update and delete,indert query activity in database.Which make it slow, how do we know if this thing happened and how to solve it?

View Replies !
$_POST From HTML --> PHP --> HTML
I've read a bunch of threads but I think I'm missing something.

I am using paypal as a payment method for a client.

But I need to do some variable checking before sending the customer to the paypal page.

I want to pass the variables to paypal as post (so the url doen't get crazy).

Is there a way to pass post variables to a PHP page that doesn't ouput anything (expect header redirect), and include those variables so they appear at the page that is redirected to?

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 !
PHP In Html Or Outside Html Page?
what's better, php code in html page or outside the page in seperate php file...the thing is i have my sql data in that code and i don't want people to see it, can people open up the php files?

View Replies !
Html Emails Vs. Non-html
I've sent out html emails and I have had a few people tell me they can't see the html, only the raw code. I imagine it's easy to tell them to activate viewing their emails in html. But, is there a way for the code to distinguish between emails that do not view the html properly? How can I fix this situation?

View Replies !
Why No [fragment] In Parse_url($_SERVER['PHP_SELF'])?
I'm trying to identify which named anchor is currently being viewed on a
page. Although the address bar of my browser shows #whatever appended to
the end of the url, I can't seem to find it in a variable.

My efforts below return no value for ANYTHING except [path]. Am I missing
something?

$url = parse_url($_SERVER['PHP_SELF']);

$scheme = ($url[scheme]);
$host = ($url[host]);
$port = ($url[port]);
$user = ($url[user]);
$pass = ($url[pass]);
$path = ($url[path]);
$anchor = ($url[fragment]);

echo $scheme." = scheme<br>";
echo $host." = host<br>";
echo $port." = port<br>";
echo $user." = user<br>";
echo $pass." = pass<br>";
echo $path." = path<br>";
echo $anchor." = anchor<br>";

View Replies !
<link:page.html,xxx> => <a Href="page.html?id=xxx">
I want to transform this code <link:page.html,xxx> to

<a href="page.html?id=xxx"> dynamically.

I tried out alot of preg_replace stuff, but I didn't get to manage it.

View Replies !
Include An Html File In Another Html File?
Can I include an html file in another html file usign PHP? Something like the way you would inlclude a text file, only have the html elements show up?

View Replies !
.doc To .txt/.html?
Hi everyone,

I'm making a site where people can upload articles, that are then stored in a mySQL db. The problem will come, of course, when people want to upload Word documents. Which they will.

Is there any way in PHP of turning the .doc file into a .txt? Or even better, a html file with any formatting (bold etc) intact?

A problem I have with my current site, on a related note, is that when people cut and paste from a word document into the form field, then submit it to the db, the resulting text is displayed with non-valid ASCII characters, which the w3c validator chokes on. I'm pretty sure there is a function that converts them, but a search of the manual didn't bring it up.

I'd really appreciate any help you can give me...

View Replies !
HTML 2 PHP
I'm trying to convert my site from html to php. Instead off having to write seperate html files I want to insert my files in a kind of template file (index.php).

I know that the include() function can do that so I have links in the form of index.php?file=whatever.php, but i don't want directly link to my files directly but i want to user variables for that. so my url will say index.php?file=variable or something.

Can I set variables in my index.php so he checks for that variable and replaces the $file with that variable? So if my variable is $foo='anypage.php' that my url will say index.php?file=foo instead of the real filename.

View Replies !
Html Into Xml Tag?
do u know how can i put html into and xml tag
Example:

<element><br></element>

i receive error "the page is not well formatted" ...



View Replies !
HTML & PHP
how do i define a php variable using html?
i want to set an shtml page as a page with links to products - when each
button is pressed it it sets the product_category variable and lists all
entries with this variable - how do i set the html link to set the
variable? wat do i need to set the product_category to?

View Replies !
--PHP To HTML
if that's the case, please just tell me where the best place for
a newbie PHP question would be.

I'm just learning PHP, and I need to know how to pass data from an HTML
input form to become the content of a new HTML page, using PHP.

In other words, I have an HTML page that lists parenting program
information, thus:

PROGRAM 1
Start Date: Aug 5
End Date: Dec 5
Time: Every second Thursday, 11:00am to 1:30pm
Location: X Building
Duration: 12 weeks
Capacity: 10 parents

PROGRAM 2
Start Date: Aug 7
End Date: Oct 14
Time: Wednesdays, 6:00pm to 9:00pm
Location: Y Building
Duration: 10 weeks
Capacity: 15 parents, up to 30 children

There are about 15-20 programs being offered at any given time, and they're
constantly being added, deleted, and changed, so it's too hard to update
them manually myself. What I want to do is:

1) Design an HTML input form on an intranet page that will allow users to
add, change, or edit program data based on the fields listed above. I know
enough HTML to do this.

2) Take that data and pass it to a new HTML file that will be available to
the public, called "Our Program Info", which will list all the program info.

I did try to RTFM to figure out step 2; but the manual is so large, and I'm
so bad at programming in general (the only reason I'm doing this is because
my wife runs the charity organization that this is for), that I couldn't
find the right place to look. If someone could (gently) nudge me in the
right direction,

View Replies !
PHP-Yes, HTML-No --- Why?
I have a tiny program:

<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>MyTitle</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1"/>
</head>
<body>

<?php
$host = $_SERVER['HTTP_HOST'];
$server = strtolower($host);

echo 'My variables<bg>'

echo("<br>Host: $host");
echo("<br>Server: $server");

?>
</body>
</html>

I upload it to my webserver as test.html and as test.php. Then I test
them in my webbrowser. The test.html does not work, but the test.php
does.

View Replies !
PHP Using Php Var In Html
What is going wrong?

$mystring= "part1 part2 part3" // remark the spaces!
.....
<td >
<input type="text" name="test" size="50" value=<?echo ($mystring);?>>
</td>
.......
the text field will only show "part1" and not the rest of the string!

View Replies !
Php To Html?
I urgently need to develop a site with around 30-40 pages.

The site must be multilingual. Usually I use a top.php which generates a
lot of my structure. Then for every page I do:

include('top.php');
....page stuff...
include('footer.php');

in this case if I want to add a simple thing in my menu I only change it
in top.php. For the language part I inlcude a lang.php which is like this:

$lang["menuHome"]["en"]="Home";
$lang["menuHome"]["gr"]="Αρχική";

and so on. In my pages I only put print $lang["menuHome"][$l] where $l
is "en" or "gr" (http://.../page.php?l=en)

The site I must develop must be in php for the web but the customer
asked to have it on a CD-ROM, which of course should be simple html.

Is there a tool to convert my site in simple html?


View Replies !

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