Posts

Showing posts from February 9, 2011

Hiding Modules when a User Logs In

<?php // Get the user object $user = &JFactory::getUser(); // Now work out the User ID $userId = $user->get('id'); // Now hide the module if user is logged in if ($userId == 0) : // Now we break out of the PHP tags and display the JDOC tag to include the module ?> <jdoc:include type="modules" name="public-right" style="xhtml" /> <?php endif; ?>

Module Position in Joomla

Load One Module Position<?phpif($this->countModules('user1')) : ?> <div id="user1"> <jdoc:include type="modules" name="user1" style="xhtml" /> </div> <?phpendif; ?>Load Four Module Positions<?phpif($this->countModules('user1 or user2 or user3 or user4')) : ?> <div id="userModules">   <?phpif($this->countModules('user1')) : ?> <div id="user1"> <jdoc:include type="modules" name="user1" style="xhtml" /> </div><!-- end user1 --> <?phpendif; ?><?phpif($this->countModules('user2')) : ?> <div id="user2"> <jdoc:include type="modules" name="user2" style="xhtml" /> </div><!-- end user2 --> <?phpendif; ?><?phpif($this->countModules('user3')) : ?> <div id="user3&q…

Detecting Logged In State in Joomla

<?php$userattr = JFactory::getUser(); $thisuser = $userattr ->get('guest'); if($thisuser == 0){?>// is this a guest user?//yes. do guest user stuff<?php}else{?>//no. do logged-in user stuff<?php}?>

Detecting Frontpage in Joomla

<?phpif( JRequest::getVar('view') == 'frontpage'){?> <!-- display your home page HTML here --> <?php}else{?> <!-- display your internal page HTML here --> <?php}?>