Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

2.99 LUNA Template - Cool & New Category Listing

Quote Reply
2.99 LUNA Template - Cool & New Category Listing
Hello,

I am trying to change the way the category is displayed on the cool and new LUNA templates in the 2.99 Release Candidate.

Currently the following is displayed:

Category > Sub-Category

I would like to have it display just Sub-Category

I would also like to display an image that is associated with the category next to the category name (I already have a field for this image in my database).

The only thing I have found in the template to change is:
<%Links::Utils::format_title($title_loop, separator => $category_separator, no_escape_separator => $no_escape_category_separator, include_home => 0, link_type => 1)%>

Any help would be appreciated.

George
Quote Reply
Re: [macbethgr] 2.99 LUNA Template - Cool & New Category Listing In reply to
There's a few ways to do this. You can override format_title by creating a format_title_override global (you'll probably need to reference Links::Utils::format_title() to see what needs to be done and returned). You can also just remove the call to Links::Utils::format_title and add the appropriate template syntax. Things you'll need to know: <%title_loop%> is an array of hashes of the category structure (DUMP it to see its contents). You can also do something like <%set title_loop_last = $title_loop.length - 1%><%title_loop.$title_loop_last%> to get the last entry.

Adrian
Quote Reply
Re: [brewt] 2.99 LUNA Template - Cool & New Category Listing In reply to
Thanks,
That did not work for me, I did however find a solution to the category name, In the Build.pm file I changed the following line:

my %names = $catlink->select('LinkID', 'Full_Name', { LinkID => [map $_->{ID}, @$results] })->fetchall_list;

To this:

my %names = $catlink->select('LinkID', 'Name', { LinkID => [map $_->{ID}, @$results] })->fetchall_list;

But I still need a solution to the other problem of displaying an image. I have a feild in my category table called sm_graphic, that field contains a URL to an image that I want to display next to category name on the new and cool pages. I tried using <%sm_graphic%>, which worked fine on the subcategory template, but returned Unknown Tag: 'sm_graphic' when used on the cool or new templates.... any suggestions?

George
Quote Reply
Re: [macbethgr] 2.99 LUNA Template - Cool & New Category Listing In reply to
Editing the core files for this, is probably not a good idea, since it *is* something that can be done via a global, or another means.

What didn't work with brewt's suggetions? The last bit of html tags is what I was thinking would work, since the linked title is now returned as an array, and put together via the breadcrumbs call.


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] 2.99 LUNA Template - Cool & New Category Listing In reply to
I got the following error:
Unknown Tag: 'title_loop.$title_loop_last'

George
Quote Reply
Re: [brewt] 2.99 LUNA Template - Cool & New Category Listing In reply to
Oops, that should be:
<%set title_loop_last = $title_loop.length - 1%><%title_loop.$title_loop_last.Name%>

Adrian
Quote Reply
Re: [brewt] 2.99 LUNA Template - Cool & New Category Listing In reply to
Thanks, That did work, but how would I get it to link to the category?
Quote Reply
Re: [macbethgr] 2.99 LUNA Template - Cool & New Category Listing In reply to
<%title_loop.$title_loop_last.URL%>

Adrian
Quote Reply
Re: [brewt] 2.99 LUNA Template - Cool & New Category Listing In reply to
Thanks, that worked out fine, here is what I finally put together:

<%set title_loop_last = $title_loop.length - 1%><A HREF="<%title_loop.$title_loop_last.URL%>"><%title_loop.$title_loop_last.Name%></A>


I'm still trying to work out how to put in the graphic. The name of the field in the category table is: sm_graphic, I tried this: <%title_loop.$title_loop_last.sm_graphic%>, and ofcourse it did not work. Any thoughts?

George