homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Write Contents with PHP
Write Contents with PHP

 12:10 pm on Nov 20, 2006 (gmt 0)

I currently write contents to a file using something like this addpage.php :-
$headpart = "<?php require(\"../homeincludes/config.php\");?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n";

Problem is this becomes a pain when I have to make any global changes as I have to edit the source code for the script.

Question: is there anyway that I can place this code within a txt file and just open it, read it then write it to the page.
This would make it easier to change then by simply opening the txt file and making the changes.



 5:23 pm on Nov 20, 2006 (gmt 0)

Yes, you can use the include() [php.net] function.


 8:00 pm on Nov 20, 2006 (gmt 0)

Including it is fine, yes, however if it's going to be a .txt file the php won't be interpreted AND you may be leaving sensitive material out in the open.

You may want to call those included files something like:
if you have php that you want executed within it.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved