Posts

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   <?php if ( $this -> countModules ( 'user1' ) ) : ?> <div id= "user1" > <jdoc: include type= "modules" name= "user1" style= "xhtml" /> </div> <?php endif ; ?>   Load Four Module Positions   <?php if ( $this -> countModules ( 'user1 or user2 or user3 or user4' ) ) : ?> <div id= "userModules" >   <?php if ( $this -> countModules ( 'user1' ) ) : ?> <div id= "user1" > <jdoc: include type= "modules" name= "user1" style= "xhtml" /> </div><!-- end user1 --> <?php endif ; ?>   <?php if ( $this -> countModules ( 'user2' ) ) : ?> <div id= "user2" > <jdoc: include type= "modules" name= "user2" style= "xhtml" /> </div><!-- end user2 --> ...

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

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

Set Title in Joomla

$this->setTitle($mainframe->getCfg('sitename') . ' - ' . $this->getTitle());

show and hide text in texbox

jQuery(document).ready(function(){ jQuery('#search').focus(function(){ if(this.value=='Search fonts to Download...') { this.value='' } }); jQuery('#search').blur(function(){ if(this.value=='') { this.value='Search fonts to Download...' } }); });

Breadcrumbs in wordpress

global $post; // if outside the loop if (is_page() && $post->post_parent) { $parent_title = get_the_title($post->post_parent); echo ' » ' . $parent_title . ' » '; wp_title(''); } else if (is_page()) { echo ' » '; wp_title(''); } else { }