Gossamer Forum
Quote Reply
Yahoo Subcats Q.
Arts(664) new
Literature,Movies,Music...

Is there anyway to remove the number portion next to the category for my home page only? I like having the numbers next to the categories below the top level, but on my front page, I don't.

I am guessing the builder would need to sense that it is building the home.html part and write the categories differently in this case. Is there a simple conditional statement I could add somewhere that might do this maybe?
Quote Reply
Re: [sooke] Yahoo Subcats Q. In reply to
I did it with a conditional statement based on the category's "Image" name.

Each one of my root categories has it's own (unique) icon:

<%if Image eq'shop.jpg'%>

<a class="category_links" href="<%URL%>">

<%Full_Name%>">
</a>


<%elseif Image eq'forum.gif'%>
<a class="category_links" href="<%URL%>">
<%Full_Name%>">
</a>

... etc


<%else%>
<a class="category_links" href="<%URL%>">
<%Short_Name%>
<%if Related%>
@
<%endif%>
</a></b> <i><small><sup>(
<%Number_of_Links%>
)</sup></small></i>
<%endif%>


I left out the <%Number_of_Links%> tags for the root categories.

If you do not have unique icons (my 'Image' field) for the top categories, you could do this:

<%if Category_Template eq home.html%>

<a class="category_links" href="<%URL%>">

<%Full_Name%>">
</a>

<%else%>
<a class="category_links" href="<%URL%>">
<%Short_Name%>
<%if Related%>
@
<%endif%>
</a></b> <i><small><sup>(
<%Number_of_Links%>
)</sup></small></i>
<%endif%>



Smile Let me know if this makes sense.

Last edited by:

nt6: Apr 14, 2002, 2:35 AM
Quote Reply
Re: [nt6] Yahoo Subcats Q. In reply to
Thanks nt6!

Reading it through it made sense... I will try to implement it this morning.

I do not use images for my categories.... but the layout of your code will help me to test to see if it is a Top Level Category or not.... Perhaps somthing in an exiting field which would signify top level... then it would know, right? Better still why not have a flag which tells it 'Yes' print numbers or 'No' do not!

Most excellent, thanks againSmile

Last edited by:

sooke: Apr 14, 2002, 9:03 AM
Quote Reply
Re: [nt6] Yahoo Subcats Q. In reply to
Thats done it! Thanks again nt6Cool

I created a new column in lsql_Category called ShowNumbers. (Enum Yes,No with a default of Yes)

then

<%if ShowNumbers eq'No'%>

......... removed the numbers

<%else%>

Original code left the same

<%endif%>

Any database manipulation I do outside of LSQL I just have to remember to set all the ShowNumber='Yes' after import. I already do this with isPopular anyways otherwise I get errors in when moving links.

I used UPDATE lsql_ShowNumbers SET ShowNumbers='Yes' WHERE ShowNumbers!='No';

I think this works Wink
Quote Reply
Re: [sooke] Yahoo Subcats Q. In reply to
You could also use something like
Code:
<%if FatherID != 0%>
<small><i>(<%Number_of_Links%>)</i></small>
<%endif%>
in the subcategory.html template. FatherID stores the ID of the father category, and it is zero if the category is a toplevel category.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Yahoo Subcats Q. In reply to
Hmmm, much more efficient than my method... I'll give that a go! Thanks
Quote Reply
Re: [yogi] Yahoo Subcats Q. In reply to
I had a problem similar to this, trying to figure out what page I was on. really, I wanted the "home" page to be different from the category pages, but I also had to take into account other pages like New and Cool.

I did it by adding a <%set %> tag to the top of the templates I wanted to set on/off, and using a global. The advantage of this, is that in addition to using FatherID, CategoryID, etc, you can use a specific test to see if you are on or in a certain template.

<%FatherID = 0%> is the best way to pick up the Root Categories, ie: home page. But, it might cause some problems on other pages, such as Search, depending on how you use it.

Because of the nested template nature of Links, you need to be careful that the tag you use will always work in the situation you are in, as you expect it to.

By adding a page tag, and checking it, and setting values in a function based on that, you avoid any potential problems based on using flags that might not be set (ie: data that might not be retrieved as a tag).

Just a caution. I've had so many differently developed sites, and different "ideas" that I've been bitten several times weeks later without having realized I "broke" something else by making a quick, simple, and what seemed logical, change :)


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Yahoo Subcats Q. In reply to
Nothing like learning from others' experiences. Thanks for the advice Pugdog... I have actually decided to stick with my method of using a tag after all... it seems to be working fine. I completely agree with you... it can be difficult to know what is going to affect what after a while. It would be nice to minimize the number of mods one does, but sometimes it is just a necessity!