Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Calculate if more than two cols for cats

Quote Reply
Calculate if more than two cols for cats
Just solved it on paper, programing tonight:

Example: 4 Cols

b1 = int (subcats/cols); if rest b1++
do till b1

b2 = int (subcats-b1)/(cols-1); if rest b2++
do till b2

b3 = int(subcats-b1-b2)/(cols-2); if rest b3++
do till b3

do rest

Seems this is something for a function that calls itself; i dont know the english word.
Beacause i have only four cols i will do it on this way, if someone could program a function for x cols,
it would be helpful for others.
Quote Reply
Re: [Robert] Calculate if more than two cols for cats In reply to
Hi,

Could you expand a bit more? Not sure what your asking :/

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] Calculate if more than two cols for cats In reply to
Seems my english is very bad. ;-)

Code:
SiteHTML.pm:
1. my $breakpoint = int(@subcat / $CFG->{build_category_columns});
2. $breakpoint++ if @subcat % $CFG->{build_category_columns};

This is ok for two cols. But not for 3 or more.
Example with 4 cols and 7 cats:
1. breakpoint=int(7/4)=2
2. breakpoint =2+1=3

Means:
col1: 3 cats
col2: 3 cats
col3: 1cat

but i should be: 2/2/2/1

My goal for example is to show four cols everytime; so i need another calculating.
I will do it now with a normal solution and post it later. Better would be a function for n>2 cols than my solution for four.
Quote Reply
Re: [Robert] Calculate if more than two cols for cats In reply to
Mmm.. what version of GLinks/LSQL are you using? I believe the number of category columns is an option in Setup > Build Options (GLinks 3.x)

Hope that helps.

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] Calculate if more than two cols for cats In reply to
Shurely you can set the number of cols for cats on home and subcats on category inside the admin-menu.
The question ist that LSQL DONT calculate the cols in the way i want.
If i want to sho four cols for example i dont want three, but this happens in some cases.

It is programed for 2 columns people usually use, but not for 3 or 4 as you can see above.