check whether there is category or item template

More
12 years 8 months ago #17837 by pabro
Hi,

how is the code to check wheter its a category or item view in template? I want to display content only if its a category view and/or item view.

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

More
12 years 8 months ago #17838 by loicberder
hello,

in the template folder (/components/com_flexicontent/templates/yourtemplate/) choose :

item.php for the items wiew

and for the category view it depend of wich part you want to modify
mainly use : category.php



Loïc

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

More
12 years 8 months ago #17839 by pabro
yes, i know! :)

but i need to check this in template (outside of item.php or category.php) with
Code:
<?php if ... ?>
but i downt know how i can identify the view.

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

More
12 years 8 months ago #17855 by ggppdk
If you are writing code for a plugin or module,
you can do like this:
Code:
$option = JRequest::getVar('option', ''); $view = JRequest::getVar('view', ''); //DETECT inside category view if ($option=='com_flexicontent' && $view=='category') { ... } //DETECT inside items view if ( ($option=='com_flexicontent' || $option=='com_content') && ($view=='items' || $view=='article') ) { ... }

I included code for 'com_content' and 'article' because 1.5.6 beta will set option and view to 'com_content' and 'article', when calling content plugins for better compatibility, and then restore them ...

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.259 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline