Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
jane65
Regular
Regular


Joined: Feb 24, 2009
Posts: 81
Location: UK

PostPosted: Mon Jun 09, 2014 5:25 pm Reply with quote

Hi,

Is it possible to hide the left side blocks on the Home Page only? I still want to keep the left side blocks displaying on all other pages.

Thanks in advance for any help with this Smile
 
View user's profile Send private message
neralex
The Mouse Is Extension Of Arm


Joined: Aug 22, 2007
Posts: 1296
Location: Germany

PostPosted: Mon Jun 09, 2014 9:27 pm Reply with quote

In general it isn't impossible but all blocks are site-wide displayed. Its a question about your used theme. With a modern theme you can change it with new/modified css-classes in your theme.php but with older table-based themes it could be hard without a deeper code change.

php Code:
if (defined('HOME_FILE')) {

# do what you want
}
 
View user's profile Send private message
jane65
PostPosted: Tue Jun 10, 2014 8:35 am Reply with quote

Hi, thanks for your help neralex, that pointed me in the right direction as I managed to do it, although I'm not sure if the code is perfect......but it does seem to work. I'm using the RickTido theme, and created a custom home page, hence the reason why I don't want the blocks on it but I need the left side blocks on all other pages. I also did the same for the right blocks too, just in case I want to activate them later. I've pasted the code below for anyone else that wants to do this.

I changed this code in the theme.php

Code:


echo '<div id="mainbodycolor">';
   if (!in_array($name, $hide_blocks_left)) {
      echo '<!-- start sidebar1 --><div class="sidebar">';
    blocks('l');
    echo '</div><!-- end sidebar -->';   
   if (defined('INDEX_FILE')) {
      echo '<!-- start content --><div class="rtmain">';
   }else{ 
      echo '<!-- start content --><div class="rtmainnrb">';
     }
   }else{
echo '<!-- start content --><div class="rtmainnb">';
}

if ($banners) {
echo '<br /><div class="centered">';
echo ads(0);
echo '</div>';
}
}
/************************************************************/
/* Function themefooter()                                   */
/*                                                          */
/* Control the footer for your site. You don't need to      */
/* close BODY and HTML tags at the end. In some part call   */
/* the function for right blocks with: blocks(right);       */
/* Also, $index variable need to be global and is used to   */
/* determine if the page you're viewing is the Homepage or  */
/* and internal one.                                        */
/************************************************************/

function themefooter() {
    global $index, $banners, $foot1, $foot2, $foot3, $foot4, $name, $hide_blocks_left;   
     echo '</div><!-- end content -->'; 
    if (defined('INDEX_FILE')and !in_array($name, $hide_blocks_left)) {

   echo '<!-- start sidebar2 --><div class="sidebarr">';      
   blocks('r');
   echo '</div><!-- end sidebar2 -->';
    }
    $footer_message = ''.$foot1.'<br />'.$foot2.'<br />'.$foot3.'<br />'.$foot4.'';   
     echo '</div><!-- wrap ends here --></div><!-- footer starts here --><div class="footer">' . LGL_MENU_HTML . '<br />Theme by <a href="http://trickedoutnews.com">Nuken</a>';
  footmsg();
echo'</div>';
 
}



TO THIS


Code:
 echo '<div id="mainbodycolor">'; 

   if (defined('HOME_FILE')) {
     echo '<!-- start sidebar1 --><div class="sidebar">';
        echo '</div><!-- end sidebar -->';
echo '<!-- start content --><div class="rtmain">';
}else{ 
   if (!in_array($name, $hide_blocks_left)) {
      echo '<!-- start sidebar1 --><div class="sidebar">';
    blocks('l');
    echo '</div><!-- end sidebar -->';

if (defined('INDEX_FILE')) {
      echo '<!-- start content --><div class="rtmain">';
   }else{ 
      echo '<!-- start content --><div class="rtmainnrb">';
     }
   }else{
echo '<!-- start content --><div class="rtmainnb">';
}
}

if ($banners) {
echo '<br /><div class="centered">';
echo ads(0);
echo '</div>';
}
}
/************************************************************/
/* Function themefooter()                                   */
/*                                                          */
/* Control the footer for your site. You don't need to      */
/* close BODY and HTML tags at the end. In some part call   */
/* the function for right blocks with: blocks(right);       */
/* Also, $index variable need to be global and is used to   */
/* determine if the page you're viewing is the Homepage or  */
/* and internal one.                                        */
/************************************************************/

function themefooter() {
    global $index, $banners, $foot1, $foot2, $foot3, $foot4, $name, $hide_blocks_left;   
     echo '</div><!-- end content -->';
    if (defined('HOME_FILE')) {
     echo '<!-- start sidebar1 --><div class="sidebar">';
        echo '</div><!-- end sidebar -->';
       }else{ 
if (defined('INDEX_FILE')and !in_array($name, $hide_blocks_left)) {
   echo '<!-- start sidebar2 --><div class="sidebar">';      
   blocks('r');
   echo '</div><!-- end sidebar2 -->';
}}

 $footer_message = ''.$foot1.'<br />'.$foot2.'<br />'.$foot3.'<br />'.$foot4.'';   
     echo '</div><!-- wrap ends here --></div><!-- footer starts here --><div class="footer">' . LGL_MENU_HTML . '<br />Theme by <a href="http://trickedoutnews.com">Nuken</a>';
  footmsg();
echo'</div>';
}


Last edited by jane65 on Tue Jun 10, 2014 4:40 pm; edited 1 time in total 
neralex
PostPosted: Tue Jun 10, 2014 1:53 pm Reply with quote

I will check it tomorrow because i believe you have to change some lines in the themefooter function but i'm not sure without to test it self.

Maybe Nuken have a idea/solution for that, he is the theme-author.
 
nuken
RavenNuke(tm) Development Team


Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Tue Jun 10, 2014 2:58 pm Reply with quote

Do you want the right blocks to be hidden too?

_________________
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Send e-mail Visit poster's website
jane65
PostPosted: Tue Jun 10, 2014 4:56 pm Reply with quote

Hi, Just corrected the code in the bottom section, there was an } missing at the end. I'm not too bothered about the right blocks Nuken because I don't think I'm going to be using them at all, but it could be helpful to have the option of hiding them. Thanks neralex, your help is much appreciated Smile
 
nuken
PostPosted: Tue Jun 10, 2014 5:53 pm Reply with quote

If what you have is working, cool. You probably would not need to do anything else. If it doesn't work, you could try this:

If you want to just have the module display in home with no side blocks, find in theme.php in the function themeheader and function themefooter:
php Code:


if (!in_array($name, $hide_blocks_left)){

and

if (defined('INDEX_FILE')and !in_array($name, $hide_blocks_left)) {


and change them to:
php Code:


if (!in_array($name, $hide_blocks_left) and !defined('HOME_FILE')){

and

if (defined('INDEX_FILE')and !in_array($name, $hide_blocks_left) and !defined('HOME_FILE')) {


That should remove the left and right blocks from the index. If you want the right blocks to show without the left blocks, you would need to add some new classes in the style.css that would float the main content to the left with the correct width and have the right blocks float right with proper spacing and than add some php logic in the theme.php to determine when you want those conditions to be met.
 
jane65
PostPosted: Fri Jun 13, 2014 2:29 am Reply with quote

Thanks Nuken, I will try that another time, as what I have does seem to work for me, so I'll stay with that for now to save a bit of time Smile
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
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 vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©