Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Hiding main categories on home page

Quote Reply
Hiding main categories on home page
There's been a few discussions here before about this but they are slightly different to my problem so I've created a new thread:

We have 16 main categories on our site, and we are in the process of redesigning it so that we can display a 4 x 4 listing of category icons on the home page. Previously we excluded two categories (a glossary and a test category) from being displayed via template edits in subcategory.html. We can't do this with a 4 x 4 layout as the missing categories produce gaps in the tables. This was not an issue in the previous 2 column layout but 4 columns from 18 categories is not an even split Wink.

As a rough solution I have created two dummy categories to even up the gaps i.e. each column now includes an empty cell. We already exclude the glossary and testing categories from searches via modifications to the search box HTML so that's not an issue. The only hacking I've needed to do is to edit Links/Tools.pm and do the following (new code in red) to exclude these dummy and unused categories from the category dropdown lists:

Code:

sub category_list {
# -------------------------------------------------------------------
# Return a list of all the categories.
#
my %ret;
my $cat = $DB->table('Category');
my @ids = $IN->param('CatLinks.CategoryID');
@ids = $IN->param('ID') unless @ids;
if ($CFG->{db_gen_category_list}) {
$cat->select_options('WHERE ID!=30 AND ID!=31 AND ID!=26 AND ID!=24 ORDER BY Full_Name');

I don't like editing the core code but I thought this was the quickest and simplest solution. Any opinions or comments on this are welcome though in case I haven't thought this through Wink.

Last edited by:

aus_dave: Jun 5, 2008, 7:31 PM
Quote Reply
Re: [aus_dave] Hiding main categories on home page In reply to
You doing this dynamically, or static pages? Makes a difference as to which bits you need to edit ;)

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 main categories on home page In reply to
Dynamically with static rewrites - I've made that code edit on a development server and it appears to be working ok, but the live site is always a bit of a lottery as to what might happen!
Quote Reply
Re: [aus_dave] Hiding main categories on home page In reply to
Hi,

Ok. Personally, if you're gonna edit the core code, you may as well try and make it a little neat =)

I would add a new field to the "Category" table - something like "show_cat" - then change this bit you"ve done:

Code:
WHERE ID!=30 AND ID!=31 AND ID!=26 AND ID!=24 ORDER BY Full_Name

...to something like:

Code:
WHERE show_cat > 0 ORDER BY Full_Name

That gives more flexability in the future Smile

Hope that helps.

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 main categories on home page In reply to
Thanks Andy - that's a bit neater and if we add any other hidden categories in future it will make it easier to handle.

There's quite a few posts about hiding categories through the forums with some pretty awkward solutions, hopefully the next version of GT will have this feature as part of the core code.
Quote Reply
Re: [aus_dave] Hiding main categories on home page In reply to
aus_dave wrote:
There's quite a few posts about hiding categories through the forums with some pretty awkward solutions, hopefully the next version of GT will have this feature as part of the core code.
Yeah, I think its certainly something that needs considering - as its seems quite a few people have been after it (the hardest bit, is getting git to stop showing the links in searches too - as they would need some kind of "flag" too)

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!