The category descriptions don't appear anywhere

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
vincem
Regular
Posts: 59
Joined: Sat Mar 05, 2005 6:01 am
Contact:

The category descriptions don't appear anywhere

Post by vincem » Thu Oct 06, 2005 4:27 am

I was all happy at setup to be able to type in a nice description for each of my categories. But now after many months, I finally realized that those descriptions didn't appear anywhere in the blog (apart from the admin page of course).

I looked around and found that I had replaced the main (first) header field by a custom logo and while in the month and calendar displays, the details show up in the second header field, in category display the category name shows up in the first field, and the blog name in the second.

Could someone point me in the right direct to find where to change the output of these two fields only for the category mode; I need the first header field to display nothing important (my logo is there instead) and the second to display both the category name and it's description...

For info, in my template directory, the index.tpl section relative to the header now looks like this:


<div align="center" id="serendipity_banner">

<h1><a class="homelink1" href="{$serendipityBaseURL}"><img src="/images/blog_tt.jpg" alt="The portal" style="border: none";></a></h1>
<h2><a class="homelink2" href="{$serendipityBaseURL}">{$head_subtitle|@default:$blogDescription}</a></h2>

</div>


But I assume this must remain as is and the changes must be done where the categories mode is actually being prepared...

Thanks in advance!

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: The category descriptions don't appear anywhere

Post by garvinhicking » Thu Oct 06, 2005 1:16 pm

You can try to modify it like this:

[code]<div align="center" id="serendipity_banner">

<h1><a class="homelink1" href="{$serendipityBaseURL}"><img src="/images/blog_tt.jpg" alt="The portal" style="border: none";></a></h1>
<h2><a class="homelink2" href="{$serendipityBaseURL}">{$head_title} {$head_subtitle|@default:$blogDescription}</a></h2>

</div>[code]

This way you add $head_title to the output, which contains the category name.

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/

vincem
Regular
Posts: 59
Joined: Sat Mar 05, 2005 6:01 am
Contact:

Post by vincem » Thu Oct 06, 2005 8:22 pm

Hello again Garvin,

Thanks for your suggestion, it does help and I now have the category name appear along with the blog name on the second line of the header, in category display.

But I was hoping to be able to modify the code at its source rather than in the index.tpl file, so that I could - in "by category" pages only - remove the blog name from this second header line when index.tpl is drawn, and replace it by the category description.

Any suggestions?

Thanks again!

Vince

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Thu Oct 06, 2005 11:50 pm

Yes, you can check if you are in category mode:

1. Create config.inc.php file in your template dir:

Code: Select all

<?php
$serendipity['smarty']->assign('s9y', $serendipity);
?>


2. In your index.tpl:

Code: Select all

{if $s9y.GET.category > 0}
Category mode!
{else}
Normal mode!
{/if}


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/

vincem
Regular
Posts: 59
Joined: Sat Mar 05, 2005 6:01 am
Contact:

Post by vincem » Fri Oct 07, 2005 3:38 am

Well, that wasn't helping me so much because I needed to display the category description instead of the blog name, but I found what I was looking for in the index.php file, at the point where the values are assigned to the two fields.

Here's what my index.php now looks like (lines 236 to 240):

The file:

<?php # $Id: index.php,v 1.82 2005/08/04 08:49:21 garvinhicking Exp $


My changes:

$serendipity['GET']['category'] = $matches[1];
$serendipity['GET']['action'] = 'read';
$cInfo = serendipity_fetchCategoryInfo($serendipity['GET']['category']);
$serendipity['head_title'] = $cInfo['category_name'];
$serendipity['head_subtitle'] = $cInfo['category_description'];
/*$serendipity['head_subtitle'] = $serendipity['blogTitle'];*/

So problem solved, thanks again!

Vince

Post Reply