![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jul 2005
Location: Europe
Posts: 7
Rep Power: 0
![]() |
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?
__________________
-= Click Here =- |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
If you don't know PHP, the official documentation is a very good starting point:
http://www.php.net/ |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Jan 2006
Location: MN
Posts: 7
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#5 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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).
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#6 |
|
Hobbyist Programmer
Join Date: Aug 2005
Location: Hiding from... them...
Posts: 110
Rep Power: 3
![]() |
Actually you don't need PHP for this- SSI should do the job.
__________________
:wq |
|
|
|
|
|
#7 |
|
Programming Guru
![]() ![]() ![]() |
The include method of PHP is what you want.
For instance: [PHP] <?php include ("header.php"); include ("main.html"); ?> [/PHP]
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|