Gossamer Forum
Home : Products : Gossamer Links : Discussions :

adding graphics for categories

Quote Reply
adding graphics for categories
I want to display a small graphic beside each category name. What is the best way to do this? I'm looking around the forum but haven't found anything about this yet, the extra columns discussed seem to be more for sites that have users upload and buy stuff. These graphics would just be eye candy. Do I have to do this in the Luna css (and which class/style would I have to change) or should I use the template globals? I have not upgraded yet, I just want to get this set up and then I'll deal with that. Thank you, S
Quote Reply
Re: [shell] adding graphics for categories In reply to
I have an extra field in the category table that holds the filename of the graphic.

In the template I just use the tag for that field to display the graphic for that category.
Quote Reply
Re: [Alba] adding graphics for categories In reply to
Hi, thanks for that. I couldn't find an actual "table" anywhere except for the footer table in css so I downloaded the newest version but I still see no tables (maybe you meant the content wrapper?). I'm still far from advanced in css but wouldn't I need to create a style that would work with dl, dt & dd and then figure out where to put a tag in index or home? Some of the available user templates have changed but I can't see a template just for the home "category area" (no table). I want these graphics on all the pages so I presume I would have to go into category.html and link.html etc. to insert them.
Quote Reply
Re: [shell] adding graphics for categories In reply to
okay, this is my latest try from a post on the site. The link is dead so I don't know what info I'm missing. If my new column name in my "category" table is "Image" where does that go in the global? And if not there, where do I reference the new column name? And when he says don't put the images in a "cgi" folder does he mean any folder in admin, I have the path going to /glinks/admin/templates/images. Thanks, S

Find this solution on a opst by Alex

Add a global called image_name =>

sub {
my ($col, $id) = @_;
return $DB->table('CAtegory')->file_info($col,$id)->File_RelativePath;

and then in your category.html template you can put:

<img src="/images/<%image_name('Portrait',$ID)%>">

My comments

Where /images is the path as defined in
File Save URL in the image field
Images should not be in a cgi folder in order to be accessed

Quote Reply
Re: [shell] adding graphics for categories In reply to
okay again...now I've got this. This line in my category.html gets me a reference to the "alt" beside the category name where I have uploaded an image, but no image. This is the path in the source. So, after "glinks" rather than the image name it says jump.cgi
I have no issues with the fact that I'm doing something very wrong...would appreciate it if anyone could give me some info, I am trying to learn but there are different ways to do this and I'm trying them. S
<img src="path(I put in "path" and took aout the real path/glinks/jump.cgi?ID=63;view=Image" alt="Saints Image">