Page 1 of 1

Head_titles and defaults

Posted: Fri Dec 29, 2006 1:09 pm
by davidlowry
Hi All

I've decent experience in PHP and programming in general, but am new to Serendipity and Smarty tpl.

Code: Select all

<div id="left">
	<h1><a href="{$serendipityBaseURL}">{$head_title}</a></h1>
	<h2><a class="homelink2" href="{$serendipityBaseURL}">{$head_subtitle|@default:$blogDescription}</a></h2>
</div>
<div id="content">
	<h1 id="title"><a href="{$serendipityBaseURL}">{$head_title|@default:$blogTitle|truncate:80:" ..."}</a></h1>
	{$CONTENT}
</div>
A beginner's question I guess:
On my homepage h1 and h2 are blank, h1#title shows the blog title.
On an item page h1 and h1#title show the entry title and h2 shows the blog title.

What I want to see is this:
h1 always shows the blog title
On homepage h1#title shows blog title
On item page h1#title shows the entry title

Can anyone point out what I'm doing wrong: I don't understand why h2 is inheriting what I believe h1 should be displaying.

(I think essentially what I want to know is how do I get

Code: Select all

@default:$blogTitle|truncate:80:" ..."
to display by itself?)

Thanks for any help forthcoming.

Re: Head_titles and defaults

Posted: Sun Jan 14, 2007 4:52 pm
by garvinhicking
Hi!

Seems I completely missed this post. :(

To make things work you should use this code:

Code: Select all

<div id="left">
   <h1><a href="{$serendipityBaseURL}">{$blogTitle}</a></h1>
   <h2><a class="homelink2" href="{$serendipityBaseURL}">{$head_subtitle|@default:$blogDescription}</a></h2>
</div>
<div id="content">
   <h1 id="title"><a href="{$serendipityBaseURL}">{if $view == 'entry'}{$head_title}{else}{$blogTitle}{/if}</a></h1>
   {$CONTENT}
</div> 
Note that this $view variable is only available since Serendipity 1.0 and above!

HTH,
Garvin