Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 1st, 2006, 11:18 AM   #1
Nimwa2
Newbie
 
Join Date: Jul 2005
Location: Europe
Posts: 7
Rep Power: 0 Nimwa2 is on a distinguished road
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 =-
Nimwa2 is offline   Reply With Quote
Old Feb 1st, 2006, 11:28 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Feb 1st, 2006, 12:24 PM   #3
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
If you don't know PHP, the official documentation is a very good starting point:

http://www.php.net/
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Feb 1st, 2006, 8:37 PM   #4
Plate
Newbie
 
Join Date: Jan 2006
Location: MN
Posts: 7
Rep Power: 0 Plate is on a distinguished road
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.
Plate is offline   Reply With Quote
Old Feb 1st, 2006, 8:43 PM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Feb 1st, 2006, 9:13 PM   #6
Silvanus
Hobbyist Programmer
 
Silvanus's Avatar
 
Join Date: Aug 2005
Location: Hiding from... them...
Posts: 110
Rep Power: 3 Silvanus is on a distinguished road
Actually you don't need PHP for this- SSI should do the job.
__________________
:wq
Silvanus is offline   Reply With Quote
Old Feb 1st, 2006, 9:48 PM   #7
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,464
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
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."
Infinite Recursion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:06 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC