PDA

View Full Version : different number of columns for root and other categories


psihoza
09-25-2006, 08:36 PM
I want my root category (homepage) displaying categories in single colum but all other categories (pages deeper in site) to display 3 columns.

I've setup root category to be unique and changed index0.tpl a bit but the problem above I cannot solve. Was playing with layout.php and print_categories function but don't know how to detect root category there and feed proper parameters to function then.

Dave Baker
09-26-2006, 05:46 PM
Hello psihoza,
Try this:
Admin Panel -> CONFIGS -> Page Navigation and Listings -> Number of columns -> Choose necessary number of columns -> Save

psihoza
09-27-2006, 09:28 PM
wouldn't that change number of columns on all pages? I want 1 columns on homepage (root) and 2 columns on all other pages.

Sergey Ten
09-27-2006, 09:43 PM
Hello psihoza,

Follow this directives:

*** Open your templates/Layout.php ***
*** Find 175 line ***


$aCols = ($value['num_cols']) ? $value['num_cols'] : $aCols;


*** Replace with ***


$aCols = ($value['id_parent'] != 0) ? 2 : $aCols;


*** Save change ***

psihoza
09-28-2006, 08:29 PM
works great, thx!

But I need one more thing :) I also want 10 subcategories displayed on homepage (root) while the rest of the site (and settings) do not display any subcategories.

What I did is: inserted "$aSubcategories = ($value['id_parent'] == 0) ? 10 : $aSubcategories;" one line below of line you edited. PHP syntax is not my game (ASP past) so I know it works but am not sure if it is optimal place/code.

edit: it doesn't work after all (my line of code I mean)