Gossamer Forum
Quote Reply
hiding empty categories
Is it possible to hide empty categories pages?

There are some empty categories, and I'm afraid those pages are in violation with the Adsense TOS.

Theo


http://www.atyourspace.com

Quote Reply
Re: [The-o] hiding empty categories In reply to
<%if Number_of_Links '>' '0'%>
<dt><a href="<%URL%>"><%Name%></a>. </dt>
<%endif%>

It won't stop the pages building but they won't be listed on the parent category pages.
Quote Reply
Re: [Alba] hiding empty categories In reply to
In Reply To:
<%if Number_of_Links '>' '0'%>
<dt><a href="<%URL%>"><%Name%></a>. </dt>
<%endif%>

It won't stop the pages building but they won't be listed on the parent category pages.

Where do I have to include this?

Theo


http://www.atyourspace.com

Quote Reply
Re: [The-o] hiding empty categories In reply to
Hi,

Quote:
Where do I have to include this?

subcategory.html :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] hiding empty categories In reply to
In Reply To:
Hi,

Quote:
Where do I have to include this?

subcategory.html :)

Cheers

ThanksBlush

Theo


http://www.atyourspace.com

Quote Reply
Re: [Alba] hiding empty categories In reply to
Unless you as the webmaster are populating the categories, hiding empty categories is a two way sword.

While users won't see a lot of empty categories, they also won't be prompted to post or add content to those areas either.

If you have a directory that requires the user to be in the category to add a link, that can't happen (eg: db_gen_category_list => no)

Very often, adding a default description "This category has no links, be the first to add one" can help populate them. A bit of testing can prevent that from being added to a category that has no links, but does have subcategory links.

Just a few other thoughts.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [The-o] hiding empty categories In reply to
Another way around this is to regulate your Google Ads according to the number of links you have on a page.

In category.html, I do someting like this:

<%if links_loop.length == 0%>
<%set rightcol_displaymode = 0%>
<%elsif links_loop.length < 10%>
<%set rightcol_displaymode = 1%>
<%else%>
<%set rightcol_displaymode = 2%>
<%endif%>

Then, in include_rightsidebar.html:

<div id="rightsidebar" align=center>
. . . other stuff ...
<%if rightcol_displaymode == 0%>
<!-- no google ads here -->
<%elseif rightcol_displaymode == 1%>
<%include include_googleads_120x240_as.html%>
<%elseif rightcol_displaymode == 2%>
<%include include_googleads_120x600_as.html%>
<%endif%>
... other stuff ...
</div>

Regards,
Peter Puglisi
www.ausfreedom.com
Ultimate Freedom is our game.
Quote Reply
Re: [rocco] hiding empty categories In reply to
In Reply To:
Another way around this is to regulate your Google Ads according to the number of links you have on a page.

In category.html, I do someting like this:

......

Good idea!

Thanks.

Theo


http://www.atyourspace.com

Quote Reply
Re: [rocco] hiding empty categories In reply to
Nice idea, but where would you place that code in category.html ?
Blacknight Solutions - Hosting
Search.ie
Armchair.ie
Quote Reply
Re: [blacknight] hiding empty categories In reply to
 Just before:

<%include include_rightsidebar.html%>

Regards,
Peter Puglisi
www.ausfreedom.com
Ultimate Freedom is our game.

Last edited by:

rocco: Aug 20, 2005, 4:20 AM
Quote Reply
Re: [rocco] hiding empty categories In reply to
Thanks - I'll give that a try
Blacknight Solutions - Hosting
Search.ie
Armchair.ie
Quote Reply
Re: [blacknight] hiding empty categories In reply to
Am trying a similar thing, using the following:

Code:
<%if Number_of_Links eq '0'%>
<p>Currently there are no articles for this category.
We have selected these top ten for you to review.
If you would like to submit an article, please go to
"<a href="/cgi-bin/add.cgi">Add An Article</a>" and login.</p>

<%topten%>
<%else%>
<%links%>
<%endif%>

I've tried <%if Number_of_Links ne '0'%> or <%if Number_of_Links '<' '0'%>

Whatever I do, I keep getting an empty field, and not printing the "Currently there are no articles for this ..." part, just keeps coming up blank... If I switch the two, will get the "Currently there are no articles for this..." part, but no links... am replacing the <%links%> part in category.html with the code above...
Any suggestions?

</not a clue>

Last edited by:

Dinky: Sep 11, 2005, 8:41 PM
Quote Reply
Re: [Dinky] hiding empty categories In reply to
I think I figured out the problem, just don't know how to work around it. The <%Number_of_Links%> tag for the category page counts the total number of links in that specific category and also counts all of the links in any of its subcategories so you will alway come up with something, unless you have an entire directory structure with no links in it...

Any suggestions on how to count just the number of links in the subcategories and have it do the above???

</not a clue>
Quote Reply
Re: [Dinky] hiding empty categories In reply to
Disregard, really doggone stupid mistake Blush was putting the code in between, <%if links%> and <%endif%> Blushagain, and Blushagain...

also used the previously posted code:

<%set Link_Counter = 0%>
<%loop links_loop%>
<%set Link_Counter += 1%>
<%endloop%>

to get by the subcategory link count...
Cool

</not a clue>
Quote Reply
Re: [Dinky] hiding empty categories In reply to
Okay,
Here's my final solution to having content available in empty categories for those that need it:

First, put the following code at the top of your category.html. It won't show on the page so don't worry about it messing up your formatting:

<%set Link_Counter = 0%>
<%loop links_loop%>
<%set Link_Counter += 1%>
<%endloop%>

This will do an actual count of links within your empty subcategory, not the entire directory structure.

Next, in place of the <%links%> on your category.html put the following:

<%if Link_Counter eq 0%>
<p>Currently there are no articles for this category. We have randomly selected a few articles for you to review. If you would like to submit an article, please go to "<a href="/cgi-bin/add.cgi">Add An Article</a>" and login.</p>

<p><%randomlink%></p><p><%randomlink%></p><p><%randomlink%></p>

<%else%>
<%links%>
<%endif%>

Replace the random global with a top ten global or with whatever you need to be displayed.

To keep from making the same stupid mistake I made earlier, refer to the stupid mistake above Wink

Hope it helps..

</not a clue>

Last edited by:

Dinky: Sep 12, 2005, 5:14 PM
Quote Reply
Re: [Alba] hiding empty categories In reply to
Hi

In subcategory.html If I add this, does not work

The code in subcategory I have is:

Code:
<dt>
<a href="<%escape_html URL%>">
<%if RelationName%>
<%RelationName%>
<%else%>
<%Name%>
<%endif%>
<%if Related%>@<%endif%></a> (<%Number_of_Links%>)<%if Has_New_Links eq 'Yes'%>
<span class="new-item"><span>nuevo</span></span><%endif%>
<%if Has_Changed_Links eq 'Yes'%> <span class="updated-item"><span>actualizado</span></span><%endif%>
</dt>
<%if Description%><dd><%Description%></dd><%endif%>


And to make this work, I changed to:

Code:
<%if Number_of_Links '>' '0'%>

<dt>
<a href="<%escape_html URL%>">
<%if RelationName%>
<%RelationName%>
<%else%>
<%Name%>
<%endif%>
<%if Related%>@<%endif%></a> (<%Number_of_Links%>)<%if Has_New_Links eq 'Yes'%>
<span class="new-item"><span>nuevo</span></span><%endif%>
<%if Has_Changed_Links eq 'Yes'%> <span class="updated-item"><span>actualizado</span></span><%endif%>
</dt>
<%if Description%><dd><%Description%></dd><%endif%>

<%endif%>





In Reply To:
<%if Number_of_Links '>' '0'%>
<dt><a href="<%URL%>"><%Name%></a>. </dt>
<%endif%>

It won't stop the pages building but they won't be listed on the parent category pages.

Last edited by:

tenoch: Nov 21, 2006, 9:19 AM
Quote Reply
Re: [tenoch] hiding empty categories In reply to
You don't need to quote =)

Code:
<%if Number_of_Links > 0%>
...
<%endif%>
Cool

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!