Joomla! Discussion Forums



It is currently Sun Nov 22, 2009 3:01 am (All times are UTC )

 


Forum rules

Please submit all new Tips and Tricks to: http://docs.joomla.org/Category:Tips_and_tricks



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
Posted: Sat Dec 29, 2007 8:31 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Sat Dec 29, 2007 8:05 pm
Posts: 1
Well, after fiddling with the site for few hours, I figured out how to hide the title of a specific news item on the front page ( also the author field ).  I basically wanted to have a 2 column layout with stories/news, but between them i wanted to have some pictures. So i placed the image inside a story, by itself and then the only thing left is to hide the title/author of that particular story.

The way I did it was by using keywords. Basically, if the Title contains the word "stefan" ( the name of my cat ) it is left behind. Similarly for the author, if the alias for the author is "stefan", the author field is left out.

Of course you can change the word "stefan" to anything you want :)

Hope it helps someone in the future.

It's all done inside the content.html.php file of Joomla! 1.0.13.

DISCLAIMER: Make a backup, and modify at your own risk. I'm no php expert and if anyone can make the code any better, please do so :)

Title: Line 617
Code:
      function Title( &$row, &$params, &$access ) {
      if ( $params->get( 'item_title' ) ) {
      
         $findme = 'stefan';
         $mystring = $row->title;
         $cutout = strpos($mystring, $findme);
         
         if ($cutout !== false)  {
         ?>
      
         <?php
            }
            
         else {
            if ( $params->get( 'link_titles' ) && $row->link_on != '' ) {
               ?>
               <td class="contentheading<?php echo $params->get( 'pageclass_sfx' ); ?>" width="100%">
                  <a href="<?php echo $row->link_on;?>" class="contentpagetitle<?php echo $params->get( 'pageclass_sfx' ); ?>">
                     <?php echo $row->title;?></a>
                  <?php HTML_content::EditIcon( $row, $params, $access ); ?>
               </td>
               <?php
            } else {
               ?>
               <td class="contentheading<?php echo $params->get( 'pageclass_sfx' ); ?>" width="100%">
                  <?php echo $row->title;?>
                  <?php HTML_content::EditIcon( $row, $params, $access ); ?>
               </td>
               <?php
            }
         }
      }
         
      else {
         ?>
         <td class="contentheading<?php echo $params->get( 'pageclass_sfx' ); ?>" width="100%">
            <?php HTML_content::EditIcon( $row, $params, $access ); ?>
         </td>
         <?php
      }
   }


For the author. on line 816:
Code:
   function Author( &$row, &$params ) {
      if ( ( $params->get( 'author' ) ) && ( $row->created_by_alias == 'stefan' ) ) {
         ?>
      
         <?php
      }
         
      elseif ( ( $params->get( 'author' ) ) && ( $row->author != '' ) ) {
         ?>
         <tr>
            <td width="70%" align="left" valign="top" colspan="2">
               <span class="small">
                  <?php echo _WRITTEN_BY . ' '.( $row->created_by_alias ? $row->created_by_alias : $row->author ); ?>
               </span>
                 
            </td>
         </tr>
         <?php
      }
   }


Top
   
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group