get current category id

Register an Account
Pligg Chat Room
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-31-2008, 07:27 AM
mrgekko's Avatar
New Pligger
 
Join Date: Jul 2008
Posts: 6
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&auml;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
Reply With Quote
  #2 (permalink)  
Old 08-03-2008, 08:12 AM
mrgekko's Avatar
New Pligger
 
Join Date: Jul 2008
Posts: 6
Any ideas people? Or maybe there's another solution to what I'm trying to achieve?
Reply With Quote
  #3 (permalink)  
Old 08-03-2008, 08:23 AM
Toon's Avatar
Casual Pligger
Pligg Version: 995
 
Join Date: Oct 2007
Location: Sheffield, UK
Posts: 36
If you go to your admin > Category Admin and click on category it gives you the numbered ID of each category is that any good to you?
Reply With Quote
  #4 (permalink)  
Old 08-03-2008, 02:23 PM
mrgekko's Avatar
New Pligger
 
Join Date: Jul 2008
Posts: 6
Hi Toon,

Thanks for your input! Unfortunately that won't help me . 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.

If I can get the id of the current category I could compare that to $cat_array[thecat].auto_id in my iterator to decide which menu item should be marked as "current" in the menu bar.

Or, perhaps there is another solution to this (?). Haven't figured out any other way though.

Suggestions, anyone?
Reply With Quote
  #5 (permalink)  
Old 08-09-2008, 11:42 AM
mrgekko's Avatar
New Pligger
 
Join Date: Jul 2008
Posts: 6
Anyone out there with a suggestion? Would appreciate any input on this since I need to be able to use non-english characters in my category names, and to be able to use the categories for the main navigation. Else I cannot use pligg for this project which I would hate
Reply With Quote
  #6 (permalink)  
Old 09-11-2008, 08:13 AM
mrgekko's Avatar
New Pligger
 
Join Date: Jul 2008
Posts: 6
So is this not possible to do with Pligg in its current state? Pligg team - could you guys at least answer this? Usually when you spend time writing a thorough post clearly stating your problem/issue/suggestion this is something positive in forums such as this. I'd guess this is not the case here. Hmm.
Reply With Quote
  #7 (permalink)  
Old 09-11-2008, 10:58 AM
Yankidank's Avatar
Pligg Founder/Coder/Designer
Pligg Version: SVN
Pligg Template: Wistie
 
Join Date: Dec 2005
Location: Ocala, FL
Posts: 3,803
Send a message via AIM to Yankidank Send a message via Skype™ to Yankidank
I'll look into this further mrgekko, we have some issues dealing with foreign characters because not many of our developers have experience accommodating for them. It takes a lot of work to work in English alone, writing Pligg for every language makes things a bit more difficult. We are trying hard though to try to be more multi-lingual friendly though for the next version, so if anyone has any suggestions for this and other problems don't hesitate to open a thread with a solution so we can get the changes into the Pligg core for the next release.

I'll have to see if someone more familiar with foreign characters can help out with this problem, so please be patient for a fix.

Now Available: Facebook Connect Module !
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control of meta description - categories Divisive Cotton Questions and Comments 65 11-06-2009 07:10 PM
Pligg Categories Yankidank Wiki Articles 1 12-17-2008 10:10 AM
How to show category keywords as text on the site? gnalkit Questions and Comments 4 11-26-2008 05:17 AM
get current category id mrgekko Questions and Comments 0 07-29-2008 06:18 PM
Checking for the current category Rob472 Questions and Comments 2 10-10-2007 02:04 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development