Keyword

Retrieve K2 category and item title from php code

More
11 years 10 months ago - 11 years 10 months ago #107215 by Ed
Hey all,

Within a K2 article, I am trying to retrieve the category and item title of the current page and put them in variables using php so I can pass them as parameters to another function. I am using flexi custom code module to insert php code in my k2 article. So far the only way I was able to retrieve the item title was by parsing the current URL using JURI::current(), but the URL does not include the category name. Is there a cleaner and simpler way of doing this? The name is stored in '$this->item->category->name' variable but I get an error if I attempt to call that from the article code. Ideally I would also like to retrieve K2 article extra field values and put them in variables. Any suggestions would be greatly appreciated. Thanks a bunch.

-Ed

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum