1

Is there a way that I can get the Category details in EE by just knowing the category url_title ?

Channel Category tag doesn't provide that facility : http://ellislab.com/expressionengine/user-guide/add-ons/channel/category_heading.html

2

My recommendation would be to look at Cat2 and Low Seg2Cat (if you need to infer category data from a URL segment).

0

URL Helper is a better/safer way to handle something like this.

-3

May be not the best way to do it, but this is how I did it.

{exp:query sql="
SELECT c.cat_name,c.cat_id, c.cat_description
FROM exp_categories c
WHERE c.cat_url_title = '{segment_3}'
AND c.group_id='2'"}

// You can also use categories tag if you want to get custom fields for the category. 
//{exp:channel:categories show='{cat_id}' style='linear'}
//<p> 
//{category_description}
//</p>
//{/exp:channel:categories}

<p>{cat_description}</p>

{/exp:query}
3
  • Is an excellent way, but you could improve it, if you don't mind. Add this as an alternative, please. – Sobral Jun 24 '14 at 13:28
  • This is cool plugin @RobsonSobral, thanks , but it give me category info only if they are present in URL, I want something that I can pass the url_title or name of the category and gives me the details. Solved now. – Sohail Jun 25 '14 at 8:07
  • 3
    Note that passing a segment variable to the query module is not safe - it will not be sanitized by the module before being executed, so it makes your site vulnerable to SQL injection attacks. You're better off writing a custom plugin which does the same thing but also runs ee()->db->escape_str() on the value you pass in. – Derek Hogue Jun 19 '15 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.