
June 9th, 2004, 06:31 PM
|
|
Registered User
|
|
Join Date: Jun 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Pass Data over include()?
Hi,
I'm quite new to PHP and I need some help. I want to create a completely templated site - such that index.htm would call on "body.php", and "body.php" would call "header.php", "sidebar.php" and "content.php" - all of which include both HTML and PHP code.
Using include(), I can manage to do that flawlessly. The problem is that I realised that part of the header (say the picture on it) needs to be distinct and different from each page - perhaps even the sidebar too. Reading around, I've found that one can use the include() function and the appropriate code from the called file to generate a returned statement; but that's not what I'm after. My initial thoughts of solving this would be to pass, say "index" to body.php, and that body.php would pass the same to header.php, which would then analyze it and produce the appropriate picture for the page. In that sense, index.htm and news.htm would then have different pictures for their headers.
Is that the right/best way of doing it? If so, what am I missing? If not, what alternative methods can I employ to work around this?
I read also that forms are one way of passing data through but I'd imagine that to be overly complicated for this a simple html file deployment.
Anyways, thanks for your time and I look forward to your replies
Sincerely,
Hugh Zen
|