I originally posted this in the Customization Assistance category, put that part of the forums appears to be half-dead. So I'll just go ahead and post my question here instead - sorry for duplicate posts in two categories.
Is there a way to get the current category id?
--------------------------------------
Why?
--------------------------------------
I want to put the categories in a menu list, with a class "current" if the category is the current category. Something like the following:
<li class="{if $request_category eq $cat_array[thecat].name}current{/if}">
<a href="{$URL_maincategory, $cat_array[thecat].safename}">
<span>{$cat_array[thecat].name}</span>
</a>
</li>
--------------------------------------
The problem
--------------------------------------
When dealing with non-english characters there appears to be no name when looping through the categories array that corresponds to $request_category. An example of this would be a category named "Tjänster" (means "Services" in Swedish). The following output comes for this category:
$request_category -> Tjänster
$cat_array[thecat].name -> Tjänster
$cat_array[thecat].safename -> Tj_auml%3Bnster
Thus, I can't use $request_category eq $cat_array[thecat].name}, because this will never be true (nor will $request_category eq $cat_array[thecat].safename}).
--------------------------------------
Possible solution
--------------------------------------
If I can get the current category in some way, I could compare this to $cat_array[thecat].auto_id. But I have no idea how to get the current category id, if at all possible.
Any ideas?
Cheers,
Erik





. What I need is a way to compare the current category (i.e. the category selected by the user) with the categories iterated in the navigation bar.
Linear Mode




