Head_titles and defaults

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
davidlowry
Regular
Posts: 5
Joined: Fri Dec 29, 2006 12:48 pm
Location: Northern Ireland
Contact:

Head_titles and defaults

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Head_titles and defaults

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply