So anyway, here is the deal. At the top of each page, there is a little meta tag, holding the page's 'title'. It looks similar to this:
HTML Code:
<META NAME="title" CONTENT="Test Page 1" />
I have a few pages like this. Now, I have a bit of code in my sidebar that looks like this:
PHP Code:
<?php $path = "."; $dir_handle = @opendir($path) or die(""); while ($file = readdir($dir_handle)) { $tags = @get_meta_tags($file); if(preg_match("/.php.bak/", $file)) { echo ""; } else { if(preg_match("/.php/", $file)) { echo "<a href='$file'>".$tags['title']."</a><br />"; } else { echo ""; } } } closedir($dir_handle); ?>
The code takes all the content of the current directory, separates what is a good file and what is not, and then echos the meta content of the selected file out. Relatively simple. And so far, it works. But, if I add a PHP variable with the same content and use it for the meta instead of the static html content, like this:
PHP Code:
<?php $pagetitle = "Test Page 1"; ?> <META NAME="title" CONTENT="<?php echo $pagetitle; ?>" />
The title of the page itself won't show up inside the sidebar, along with all the pages that do. I suspect it has something to do with the loop, but I have no idea how to fix it. Any suggestions?
- Steve
__________________
if($stevej == "helpful") { $talkupation += $user_power; }
Last edited by stevej; 02-24-2009 at 09:31 PM..
|