Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Category Image Display in 3.0

Quote Reply
Category Image Display in 3.0
Sorry for posting this twice, I posted this in the Development, Plugins and Globals forum, but I think it belongs in the Discussion forum.

What I would like to do is insert a graphic next to the category name on the cool and new pages. I have a field in my category table called 'sm_graphic' and tried this:

<%if sm_graphic%><a href="<%title_loop.$title_loop_last.URL%>"><img src="<%sm_graphic%>" border="0"></a><%endif%>

But it returned nothing.

Anyone know what I might be doing wrong or need to try?

George
Quote Reply
Re: [macbethgr] Category Image Display in 3.0 In reply to
I just had the V2 stuff working on Glinks3 (when i tested it) but dropped it just from performance point of view.

Here is the global which works (sorry can't recall who helped me out the last time with this ... credit still remains with him/her). This presumes that your Category table has a column Image (Form type File...)

cat_images -->

sub {
my $tags = shift;
my $file = $DB->table('Category')->file_info('Image', $tags->{ID}) or return "ID $tags->{ID} does not have a file attached.";
return $file->File_RelativePath();
}

Then in subcategory.html (Glinks3)

<dt><%if Image%><img src="<%config.build_static_url%>/default<%cat_images%>" border=0 height="x" width="y" /><%endif%><a href="<%URL%>"><%Name%><%if Related%>@<%endif%></a> (<%Number_of_Links%>)<%if Has_New_Links eq 'Yes'%> <span class="new-item"><span>new</span></span><%endif%><%if Has_Changed_Links eq 'Yes'%> <span class="updated-item">updated</span></span><%endif%></dt>
<%if Description%><dd><%Description%></dd><%endif%>

This is presuming that you have defined th path to static for Image column, x and y are self explanatory.

Should work .. but you may need to adjust... to your pages where u want them. I tested on Home page...

Thanks
HyTC
==================================
Mail Me If Contacting Privately Is That Necessary.
==================================

Last edited by:

HyperTherm: Apr 13, 2005, 4:15 AM
Quote Reply
Re: [HyperTherm] Category Image Display in 3.0 In reply to
Actually, what I had in my first post works fine in the subcategory.html template without creating the global. In the older version of LinkSQL it also worked fine in the cool and new templates as well. Now it returns nothing. I tried your global on the cool template and I get this:
ID 1889 does not have a file attached.

ID 1889 is not the category ID, it is the link ID.

Any thoughts?

George
Quote Reply
Re: [macbethgr] Category Image Display in 3.0 In reply to
This is actually the last item I need to fix in the new version before going live.... If anyone could help me I would appreciate it.

George

Last edited by:

macbethgr: Apr 14, 2005, 9:14 AM
Quote Reply
Re: [macbethgr] Category Image Display in 3.0 In reply to
Hi,

To get this working in previous versions I think you must have either edited the core code, used a plugin or used a global - can you check your previous version to see.

I can't see any other way that the image column would have been available on the New and Cool pages as the full Category info isn't passed is as far as I remember - I think it is just the linked title of the category. (I could be wrong though.)
Quote Reply
Re: [afinlr] Category Image Display in 3.0 In reply to
Yes, I have similar worries.
I just thought I missed a global or a custom feature I didn't use, yet.

Anyway, could be a good idea, to have this implemented as core feature.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [afinlr] Category Image Display in 3.0 In reply to
Yes, you are right.... I had a custom mod done by GT to accomplish this, I check with the person who did the mod and she said she will have to rewrite it for the new version....
George