Author |
Message |
06/08/2003 20:56:12
|
lbn1124
Newbie
Joined: 06/08/2003 20:51:53
Messages: 4
Offline
|
How do I add custom headers to the PHP code for Advanced Guestbook?
|
|
06/08/2003 21:11:05
|
Anonymous
|
the easy way is just modify the header.php in the Admin Panel -> Templates. The header.php needs write permission for everyone. This works if you don't have a separate header php file. If you have a separate php header file you would like to include, then it's a little harder.
My site uses a separate header php file. http://www.auburn.edu/ald
|
|
06/08/2003 21:16:13
|
lbn1124
Newbie
Joined: 06/08/2003 20:51:53
Messages: 4
Offline
|
Yes, that's what I am having such a time with. I have a custom header that I am attempting to implement into the existing header.php. I've done nothing but make a mes so far.
|
|
06/08/2003 21:52:03
|
Anonymous
|
the problem with Guestbook 2 is that it doesn't really interpret header.php (and any other template php files) as php files; it simply copy the template files and paste them into main page.
The whole story is complicated so this is what I did. First I wrote the following function and put it in template.class.php gb_template class:
//**************************************************************
// Author: Chih Wang, 2003-2004 Auburn University ALD webmaster
//**************************************************************
function custom_get_template($tpl){
if (!isset($this->template[$tpl])) {
$filename = "$this->root_dir/templates/$tpl";
if (file_exists("$filename")) {
$fd = fopen ($filename, "r");
$this->template[$tpl] = fread ($fd, filesize ($filename));
fclose ($fd);
//$this->template[$tpl] = ereg_replace("\"", "\\\"", $this->template[$tpl]);
}
}
return $this->template[$tpl];
}
Second, I search all php files for the word header and replace this line:
eval("\$guestbook_html = \"".$this->template->get_template($this->db->GB_TPL['header'])."\";");
with this line:
eval($this->template->custom_get_template($this->db->GB_TPL['header']));
Last make sure your header.php is a valid PHP file, that means all " needs to be replaced by \", but it doesn't need <?php and ?>, and include your header file in the header.php.
|
|
|