Keyword

[SOLVED] Content Type If Statements

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
8 years 11 months ago #144286 by Joe Campbell
Content Type If Statements was created by Joe Campbell
Please provide Cut & Paste code for the following If Statement(s):
  • If Item
  • If Category
  • If Category & Tag

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #144287 by Krikor Boghossian
Replied by Krikor Boghossian on topic Content Type If Statements
Do you mean if it an item, the task is category? Or do you want to show the item's category?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
8 years 11 months ago #144290 by Joe Campbell
Replied by Joe Campbell on topic Content Type If Statements
For example if you have a K2 Content Module that is visible for all K2 content views (item, category, tag, user)

But you want to show specific content based on the current view, for example:

<if view = category>
hello I'm a category
<end if>

<if view = item>
hello I'm a item
<end if>

<if view = category or tag>
hello I'm either a category or tag :)
<end if>

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago - 8 years 11 months ago #144292 by Krikor Boghossian
Replied by Krikor Boghossian on topic Content Type If Statements
Ok.

It is not that simple you have to do
IF it is K2 AND the task is a category (or view is an item).

You need this little helper.
$option 			= JRequest::getCmd('option');
$view 				= JRequest::getCmd('view');
$layout 			= JRequest::getCmd('layout');
$page 				= JRequest::getCmd('page');
$task 				= JRequest::getCmd('task');
$id 					= JRequest::getInt('id');
$itemid 			= JRequest::getInt('Itemid');
$tmpl 				= JRequest::getCmd('tmpl');

If($option == 'com_k2' && $view == 'item' ) { 

}

If($option == 'com_k2' && $task == 'category' ) { 

}

If($option == 'com_k2' && ( $task == 'category'  || $task == 'tag'  ))  { 

}

With this helper you can create your own conditional tags based on the menu item, the item's id etc...

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 8 years 11 months ago by Krikor Boghossian.

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
8 years 11 months ago #144295 by Joe Campbell
Replied by Joe Campbell on topic Content Type If Statements
AWESOME - Thank you :)

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #144296 by Krikor Boghossian
Replied by Krikor Boghossian on topic Content Type If Statements
You 're welcome Joe.

Want to push it even further? Have these classes echoed in the <body> element so you can control your layout even better.

You can download one of your free templates to see it in action:
www.joomlaworks.net/joomla-templates/free-templates

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
8 years 11 months ago #144297 by Joe Campbell
Replied by Joe Campbell on topic Content Type If Statements
Thank you sir

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


Powered by Kunena Forum