Hiding / Showing FLEXIcontent modules

  • Published by
    George Papadakis
  • Last modified
    11 April 2014
  • Up to date
    Yes
  • Profile concerned
    End user, Webdesigner
  • Concerns
    Modules
  • Since Version
    2.0
  • Voting
    Average rating
    2 votes
    • 1
    • 2
    • 3
    • 4
    • 5
  • Favourites
    444 Hiding / Showing FLEXIcontent modules /documentation/tutorials-english/76-modules2/444-hiding-showing-flexicontent-modules.html
  • You can use the Joomla module assingments
    How do you assign a module to specific pages?
    NOTE: since you Joomla module manager assigns modules to menu items, it maybe useful to have a default menu item for each of your Content Types (yes there is such a parameter in Content Type configuration), also in component configuration there is default menu item for tags view and for default menu item for search view
  • You can combine the above with the module parameters inside "Hide/show module" SLIDER/TAB
    ... inside it you will find rules about hiding or showing the module

  • Some times you would want to assign you module to ALL pages and then use the above parameters to control the display of it

  • You can even use PHP code to control when your FLEXIcontent module will be shown

e.g. FLEXIContent item view for items in categories 34, 56, 78
Parameter: Combine rules: AND
Parameter: Show in views: none

1
2
3
4
5
return (
JRequest::getCmd( 'option' ) == 'com_flexicontent'
&& in_array(JRequest::getCmd( 'view' ), array('item','items'))
&& in_array(JRequest::getInt( 'cid' ), array(34, 56, 78))
);

 

e.g. FLEXIContent category view for categories 34, 56, 78
Parameter: Combine rules: AND
Parameter: Show in views: none

1
2
3
4
5
return (
JRequest::getCmd( 'option' ) == 'com_flexicontent'
&& JRequest::getCmd( 'view' ) == 'category'
&& in_array(JRequest::getInt( 'cid' ), array(34, 56, 78))
);

 


e.g. in ALL FLEXIContent tags view
Parameter: Combine rules: AND
Parameter: Show in views: none

1
2
3
4
return (
JRequest::getCmd( 'option' ) == 'com_flexicontent'
&& JRequest::getCmd( 'view' ) == 'tags'
);

 


e.g. in FLEXIContent tags view
Parameter: Combine rules: AND
Parameter: Show in views: none

1
2
3
4
return (
JRequest::getCmd( 'option' ) == 'com_flexicontent'
&& JRequest::getCmd( 'view' ) == 'favourites'
);

e.g. in FLEXIContent item view, for items with content type -2-
Parameter: Combine rules: AND
Parameter: Show in views: none
Parameter: PHP rule:

if (JRequest::getCmd( 'option' ) != 'com_flexicontent') return false;
if (!in_array(JRequest::getCmd( 'view' ), array('item','items'))) return false;

$fc_item_id = JRequest::getInt( 'id' );

$db = JFactory::getDBO();
$query = "SELECT type_id FROM #__flexicontent_items_ext WHERE item_id=". $fc_item_id;
$db->setQuery($query);
$type_id = $db->loadResult();

return ( $type_id == 2 );

 

e.g. in FLEXIContent item view, for items with content type -2-  BUT use the Show in views parameter too
Parameter: Combine rules: AND
Parameter: Show in views: 'item'
Parameter: PHP rule:

$fc_item_id = JRequest::getInt( 'id' );

$db = JFactory::getDBO();
$query = "SELECT type_id FROM #__flexicontent_items_ext WHERE item_id=". $fc_item_id;
$db->setQuery($query);
$type_id = $db->loadResult();

return ( $type_id == 2 );