So, I'm messing around with my header. I have a Wordpress blog in /blog (folder in my site) and the forum is installed in /forum. I messed around with my blog header and got it the way I like it. Now I'm messing around with my pun header to make it use my blog header.
I used a pun_include in my main.tpl called masthead.php and in the user/include/masthead.php file I'm trying to use the template tags <pun_title> and <pun_desc>. Any way to do this?
Specifically, the blog header calls the functions get_option() and blog_info() so in my masthead.php I defined the functions and am trying to return the path to the blog for the first and echo the <pun_title> and <pun_desc> in the second to create the headline for my header. It gives me this error:
Parse error: syntax error, unexpected '<' in /forum/include/user/masthead.php on line 3
That's obviously where the <pun_title> is. Do I need to declare something in masthead.php to use these template tags? Or, is there a different variable I should be using (that contains the same info)? I want the info to be generated based on whatever values I punch in the admin panel and I expect to be changing the values occasionally so I do not want them to be hard-coded into the main.tpl or masthead.php files.
Thanks for any help.
Edit: So, I've been poking around in the source and the best I can tell, I should be able to use template tags. The part that does the parsing, I think, is in /header.php:
// START SUBST - <pun_include "*">
while (preg_match('#<pun_include "([^/\\\\]*?)\.(php[45]?|inc|html?|txt)">#', $tpl_main, $cur_include))
{
if (!file_exists(PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2]))
error('Unable to process user include '.htmlspecialchars($cur_include[0]).' from template main.tpl. There is no such file in folder /include/user/');
ob_start();
include PUN_ROOT.'include/user/'.$cur_include[1].'.'.$cur_include[2];
$tpl_temp = ob_get_contents();
$tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main);
ob_end_clean();
}
// END SUBST - <pun_include "*">
My understanding of this is that the code runs through main.tpl and looks for any instances of <pun_include *> where * is a valid value. It puts any instances it finds into the $cur_include array. Let's skip over the error because it is parsing my file. It starts an ouput buffer and puts my file to the output buffer, stores my included file in it, then stores the output buffer in $tpl_temp. From there, it runs through $tpl_main and replaces any instances of $cur_include[0] with $tpl_temp, then flushes the output. $cur_include[0] is going to be the pun_include, though. So, it's going through $tpl_main and looking for anywhere there is a pun_include masthead.php (in my case) and replaces it with the results.
So, I'm wrong. It doesn't replace my template tags here. Ignore this edit (though I'm leaving it as a reference for myself later).
2nd Edit: Right here, further down the header.php page, is where it's parsed.
// START SUBST - <pun_title>
$tpl_main = str_replace('<pun_title>', '<h1><span>'.pun_htmlspecialchars($pun_config['o_board_title']).'</span></h1>', $tpl_main);
// END SUBST - <pun_title>
// START SUBST - <pun_desc>
$tpl_main = str_replace('<pun_desc>', '<p><span>'.$pun_config['o_board_desc'].'</span></p>', $tpl_main);
// END SUBST - <pun_desc>
Since my page has been included in $tpl_main before this anywhere in my masthead.php that it says <pun_title> or <pun_desc> should be parsed into the appropriate values.
3rd Edit: After verifying that it is supposed to parse them I thought about the problem a little more. It wasn't recognizing my <pun_title>. The code looked like this:
function bloginfo($option) {
if ($option == "name") echo <pun_title>;
elseif ($option == "description") echo <pun_desc>;
}
For anyone that stumbles on this down the road through a search, I solved the problem by putting <pun_title> and <pun_desc> in single quotes, like so:
function bloginfo($option) {
if ($option == "name") echo '<pun_title>';
elseif ($option == "description") echo '<pun_desc>';
}
I hate being foiled by quotes.