hey all, i'm trying to implement a template system into my website (which i'm currently redesigning and redoing, hence all these wonderful new changes), and i'm attempting to use bTemplate. keep in mind, i'm not a born programmer... i can usually figure code out for myself and get by learning and picking up stuff on my own, but here and there i'll run into really simple problems that i probably wouldn't run into if i knew what i was doing. especially since i'm just starting with PHP.
in any case, if you go to this link, http://ginnymin.chaosnet.org/test.php , you'll see what i'm trying to set up. hopefully on your browser it'll show up fine (there's a lot of heavy graphics and CSS positioning and i haven't tested the design on multiple browsers), so if it doesn't and looks like a big mess, i apologize. you'll see the template, which includes mostly graphics on the uppder half and the "dynamic" content part on the lower half (which is just repeating text right now), separated by the thin horizontal menu. so it all shows up, which is a good thing... it's loading the template and content.
i've tried to set it up so that when you acess "test.php" or "test.php?section=home", you'll get the "main test content" repeating text, which is via the file test.txt; when you access "test.php?section=content1" you get "content 1" repeating via content1.txt; and for "test.php?section=content2" you get "content 2" repeating via content2.txt. if you look in the upper right corner, you'll see a small menu. i've set the "CONTACT" link to for content1, the "GUESTBOOK" link for content2, and "PLACES" for home.
my problem is that most of the time, the wrong content loads. in fact, it's loading content 1 almost all of the time. when i tried the page out for the very first time, it seemed fine because it loaded the "main test content". when i tried content 1, it loaded content 1. but when i tried content 2, it stayed on content 1, and it seems to be staying put. i'm guessing once $section is set as content1 the browser or program seems to remember that and keeps that value despite all the refreshing and switching links, but i really don't know. i have no idea how to fix this? and are people seeing the same problem?
here's what i have in the test.php :
<?php
include_once('bTemplate.php');
$tpl = new bTemplate();
if ($section == 'content1') {
$title = 'content 1';
$tpl->set('title', $title);
$tpl->set('content', $tpl->fetch('content1.txt'));
}
else if ($section == 'content2') {
$title = 'content 2';
$tpl->set('title', $title);
$tpl->set('content', $tpl->fetch('content2.txt'));
}
else if ($section == 'home') {
$title = 'main content';
$tpl->set('title', $title);
$tpl->set('content', $tpl->fetch('test.txt'));
}
else {
$title = 'main content';
$tpl->set('title', $title);
$tpl->set('content', $tpl->fetch('test.txt'));
}
echo $tpl->fetch('test.tmp');
?>
all help is MUCHO APPRECIATED! i'm guessing it's something really simple for anyone who is familiar with PHP or knows what they're doing with web programming... but as for me, i'm just clueless. you can reply to this msg, or email me at ginnymin@alumni.virginia.edu, or AIM (if you use that) at "gin mei".
hope all is doing well...