Page 1 of 1

Show category title?

Posted: Thu Jun 08, 2006 6:06 pm
by DMotel
Is there a way to add the category's title to the top of the page once you get into the category?

Re: Show category title?

Posted: Thu Jun 08, 2006 8:16 pm
by garvinhicking
Hi!

You can put these variables into your index.tpl or entries.tpl file:

Code: Select all

{$category_info.category_name}
{$category_info.category_description}
(http://www.s9y.org/102.html#A33)

Regards,
Garvin

Posted: Thu Jun 08, 2006 9:05 pm
by DMotel
Hmmm not sure about how to do this. In Index.tpl I can see no logical place to paste that. In entries.ptpl I tried it somewhere in here:

<div class="serendipity_entry serendipity_entry_author_{$entry.author|@makeFilename} {if $entry.is_entry_owner}serendipity_entry_author_self{/if}">
{if $entry.categories}
<span class="serendipity_entryIcon">
{foreach from=$entry.categories item="category"}
{if $category.category_icon}
<a href="{$category.category_link}"><img class="serendipity_entryIcon" title="{$category.category_name|@escape}{$category.category_description|@emptyPrefix}" alt="{$category.category_name|@escape}" src="{$category.category_icon}" /></a>
{/if}
{/foreach}
</span>
{/if}

<div class="serendipity_entry_body">
{$entry.body}
</div>

Bu that didn't work either :cry:

Posted: Thu Jun 08, 2006 9:22 pm
by garvinhicking
Hi!

The logical place depends on where you want the text to appear, of course. ;)

I'd suggest you place the variable immediately before the {$CONTENT} variable inside index.tpl.

Best regards,
Garvin

Posted: Thu Jun 08, 2006 9:26 pm
by DMotel
Hmmm still not working:

<td id="content" valign="top">{$category_info.category_name}
{$category_info.category_description}{$CONTENT}</td>

Posted: Thu Jun 08, 2006 11:37 pm
by DMotel
Is it perhaps TOO immediately following the CONTENT variable? Is my syntax wrong?
Thanks in advance.

Posted: Fri Jun 09, 2006 11:36 am
by garvinhicking
Hi!

Hm, it works here. As soon as I select a category, the text will be shown. Of course in the default start view, a category is not set and thus you wouldn't see anything there.

Which s9y version are you using now?

Regards,
Garvin

Posted: Fri Jun 09, 2006 7:38 pm
by DMotel
Using version 0.8.2 I think.

Posted: Fri Jun 09, 2006 11:12 pm
by garvinhicking
Hi!

It doesn't work in versions older than 0.9.1.

Regards,
Garvin.

Posted: Fri Jun 09, 2006 11:16 pm
by DMotel
bummer for me :-(

Posted: Fri Jun 09, 2006 11:21 pm
by garvinhicking
Hi!

No progress on upgrading oyur s9y? :) You really should do that if you want your client to have an installation that could not be exploited/hacked easily. ;)

phpMyAdmin wouldn't really be too hard...and upgrading s9y also not.

Of course you can always upgrade without a backup, but in case something goes wrong, this would be bad.

Best regards,
Garvin

Posted: Mon Jun 12, 2006 7:49 pm
by Eni
That was a nice tip.

Code: Select all

<a id="main"></a>
	
	<h2>Category: <em>{$category_info.category_name}</em></h2>
	<p><em>{$category_info.category_description}</em></p>
	<img class="serendipity_entryIcon" title="{$category.category_name|@escape}" alt="" src="{$category.category_icon}" />
	<br />
	
	{$CONTENT}{$raw_data}
... works fine and looks really nice with the category images as separator.

Thank you, Garvin! :D

/edit
stupid eni ... have to think about hiding it at the main page^^ ... hmhmhm

Posted: Mon Jun 12, 2006 9:52 pm
by judebert
Garvin recently added a boolean variable, $startpage, to indicate if you're on the startpage. You could template like:

Code: Select all

   {if not $startpage}
   <h2>Category: <em>{$category_info.category_name}</em></h2>
   <p><em>{$category_info.category_description}</em></p>
   <img class="serendipity_entryIcon" title="{$category.category_name|@escape}" alt="" src="{$category.category_icon}" />
   <br /> 
   {/if}

Posted: Thu Jun 15, 2006 1:43 pm
by Eni
Oh, thank you!

That's great :D

Greets,
eni