Hi all. Here's the situation.
I'm building a template driven website. Each included file will contain the content for that page, and is simply put into the chosen template. However, the menu will be different on each page, as well as the title, so I'm in a bit of a quandry as to how to access individual menus and titles.
Here's what I was thinking. Each content page starts like this:
<?php
!isset($site) ? header("Location:/index.php?page=about") : "";
//About UNBC
//aboutmenu.inc.php
?>
where "about" is the page specified, so it could also be a filename, ie. "?page=faculty.php"
I built another method into the class which reads the included file into an array using the file() function, and assigns it to the variable $file_contents in the class.
Then I can simply set the title and menu file using the following code:
$this->title = substr($this->file_contents[2],0,2) == "//" ? substr($this->file_contents[2],2) : "UNBC";
$this->menu = substr($this->file_contents[3],0,2) == "//" ? substr($this->file_contents[3],2) : "default.inc.php";
It would seem to me that there has to be a more efficient way of doing this, but other than passing the variables along in the query string, which would require coding them into each link, I'm stuck.
Does anyone have any ideas?
Thanks in advance,
P.