![]() |
pages content
lets say i have 10 pages on html and it sucks to sit and edit everything on each single page isnt there some php that i can add where if i make changes in the index file it will make the same change in all the pages?
|
If you generate the similar parts with PHP, or include the similar parts, you only have to change one piece of the source. You might also investigate templates. You probably need to investigate or review the place of PHP as server-side code. Your problem, of course, isn't new; it is old and well-addressed.
|
If you don't know PHP, the official documentation is a very good starting point:
http://www.php.net/ |
Specifically, when you look into the PHP documentation, look at the "include" function. This function is will parse a PHP file where you can singly place some data. I usually use this function for larger text areas in templated websites.
If you have many small bits of data you might want look into the superglobal array "$GLOBALS" to reference, on different pages, globals values in a single file. To use this though you'll need globals enabled in the php.ini file and it can be a security risk. The next, more complex, method would be to use a database such as MySQL as a single point to store data. |
A MySQL database seems like a poor way to store boilerplate, although it would be functional. Unless you wanted to vary it with some type of query, a flat file would be better (and could be included).
|
Actually you don't need PHP for this- SSI should do the job.
|
The include method of PHP is what you want.
For instance: [PHP] <?php include ("header.php"); include ("main.html"); ?> [/PHP] |
| All times are GMT -5. The time now is 7:43 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC