Show category title?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
DMotel
Regular
Posts: 67
Joined: Fri Apr 21, 2006 8:49 pm

Show category title?

Post by DMotel »

Is there a way to add the category's title to the top of the page once you get into the category?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Show category title?

Post 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
# 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/
DMotel
Regular
Posts: 67
Joined: Fri Apr 21, 2006 8:49 pm

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

Post 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
# 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/
DMotel
Regular
Posts: 67
Joined: Fri Apr 21, 2006 8:49 pm

Post by DMotel »

Hmmm still not working:

<td id="content" valign="top">{$category_info.category_name}
{$category_info.category_description}{$CONTENT}</td>
DMotel
Regular
Posts: 67
Joined: Fri Apr 21, 2006 8:49 pm

Post by DMotel »

Is it perhaps TOO immediately following the CONTENT variable? Is my syntax wrong?
Thanks in advance.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# 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/
DMotel
Regular
Posts: 67
Joined: Fri Apr 21, 2006 8:49 pm

Post by DMotel »

Using version 0.8.2 I think.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

It doesn't work in versions older than 0.9.1.

Regards,
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/
DMotel
Regular
Posts: 67
Joined: Fri Apr 21, 2006 8:49 pm

Post by DMotel »

bummer for me :-(
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# 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/
Eni
Regular
Posts: 62
Joined: Thu Jan 27, 2005 10:47 pm
Location: Münster, Germany

Post 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
Sorry, I'm Late. But I Got Lost On The Road Of Life.
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post 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}
Judebert
---
Website | Wishlist | PayPal
Eni
Regular
Posts: 62
Joined: Thu Jan 27, 2005 10:47 pm
Location: Münster, Germany

Post by Eni »

Oh, thank you!

That's great :D

Greets,
eni
Sorry, I'm Late. But I Got Lost On The Road Of Life.
Post Reply