darkhoros VIP
Total posts: 152
22 May 2017 23:02

Hi, I need to be able to print out the category alias in the records list view template to be used as a class in the containg div, I know how to get the category name , linkied or not linked, but I am unable to et the category alias.

I hope some one can help me on this. Thank you.

Last Modified: 28 May 2017


pepperstreet VIP
Total posts: 3,837
23 May 2017 01:43

Hello, what about using the category ID instead?

<?php echo $item->category_id ;?>

darkhoros VIP
Total posts: 152
25 May 2017 00:03

Hi, thank you for your kind reply, Nope I need the alias, tried the id, style classes cant be numbers.

So I can't get the alias? Regards.


pepperstreet VIP
Total posts: 3,837
25 May 2017 02:07

I just had a quick look with PHP print_r and browser search...
The Alias seem to be inside URLs only!? But I could have missed something.

You might also use the category name, but you have to strip all unwanted characters and formatting.

I would use the ID. It is unique! Just add a static prefix like catid- or category- or anything you see fit ;)


Sergey
Total posts: 13,748
25 May 2017 14:17
class="catid-<?php echo $item->category_id ;?>"

darkhoros VIP
Total posts: 152
26 May 2017 15:30

Thank you all. Managed to get results using ID. Regards.

Powered by Cobalt