Hiding content title/author for specific story Topic is solved

A forum with Tips, tricks and small tutorials.

Moderators: mcsmom, unixboymd

Forum rules
Post Reply
ido33d

Hiding content title/author for specific story

Post by ido33d » Sat Dec 29, 2007 8:31 pm

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: Select all

      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: Select all

   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
      }
   }

Post Reply