Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Category ID in site_html.pl

Quote Reply
Category ID in site_html.pl
Hello,

i try to get the Category ID in the Category Pages.
(As shown in the Admin-Funktion when viewing categories)
I've put the following in site_html.pl (no templates!)
$rec{'ID'}

But it dont work ;-)
Does anybody now, whitch variable I can use or whitch modifications I have to make?

Thanks for any help and sorry for my bad english..



Quote Reply
Re: Category ID in site_html.pl In reply to
And which sub-routine are you putting this in?

The $rec{'ID'} codes will only work in the sub site_html_category routine.

Regards,

Eliot Lee
Quote Reply
Re: Category ID in site_html.pl In reply to
Thanks for the speed of your reply,

it is in the sub site_html_category routine.
It ist between the print qq~

If tried the following versins:

$category{$ID}
$category{$category_name}[0]
$category{0}
$rec{'ID'}

Also:
~;$category{$ID}qq~ (CGI Error)
~;$rec{'ID'}qq~ (Also CGI Errer when building pages)

I just whant to have the ID Number in the HTML-Code of the Categorypages.
Do you have any Idea?

Thanks for your help!

Kai

Quote Reply
Re: Category ID in site_html.pl In reply to
Well, what you will need to do is add the following codes in the sub site_html_print_cat since that is the sub that prints the categories.
1) Replace the following codes:

Code:

my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i);


with the following codes:

Code:

my ($id, $url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i);


2) Add the following codes:

Code:

($id) = @{$category{$id}}[0];


AFTER the following codes:

Code:

($description) = @{$category{$subcat}}[2];


3) Then replace the following line:

Code:

$output .= qq|<dl><dt><strong><a class="link" href="$url">$category_name</a></strong> <small class="numlinks">($numlinks)</small> |;


with the following codes:

Code:

$output .= qq|<dl><dt><strong>$id <a class="link" href="$url">$category_name</a></strong> <small class="numlinks">($numlinks)</small> |;


Hope this helps.

Good luck!

Regards,

Eliot Lee
Quote Reply
Re: Category ID in site_html.pl In reply to
Hello Eliot,

thanks again for you answer, but I think this is not what I need. I need the category ID to handle with this variable for an SSI. I need the Category Number in my HTML-Header, witch I define in sub site_html_category.

That meens: When I Build the pages, there should be the Category Number of the actual Category-Page.

Example: I have the category: Computer
When the script Builds the pages, it should write on
/Computer/index.html in the HTML Header the Cat (ID)Number.

In the Description in site_html.pl you give different variables like:
# $description : Category Description
# $meta_name : Meta Description Tag
# $meta_keywords : Meta Keywords Tag
# $header : Custom Header
# $footer : Custom Footer
# $related : A <li> list of related categories

All I need, ist a variable like them of the ID-Number from the actual Category.

I think there are easzer ways to describe my problem, but not with my english :-)

Can you help me again?

Thanks, Kai

Quote Reply
Re: Category ID in site_html.pl In reply to
I will have to think about this a little bit...The problem will be passing the ID from one sub to another...The easiest thing to do is rather than including a common header...use complete header codes in the sub site_html_category routine and use $rec{'ID'}.

Regards,

Eliot Lee