Author |
Message |
jane65
Regular
![Regular Regular](modules/Forums/images/ranks/2stars.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Feb 24, 2009
Posts: 81
Location: UK
|
Posted:
Mon Jun 09, 2014 5:25 pm |
|
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](modules/Forums/images/smiles/icon_smile.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
neralex
Site Admin
![](modules/Forums/images/avatars/201442295664a46e4575d46.jpg)
Joined: Aug 22, 2007
Posts: 1775
|
Posted:
Mon Jun 09, 2014 9:27 pm |
|
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
}
|
|
_________________ Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jane65
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jun 10, 2014 8:35 am |
|
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 |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
neralex
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jun 10, 2014 1:53 pm |
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
nuken
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/3234de284ee21bd39eecd.jpg)
Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina
|
Posted:
Tue Jun 10, 2014 2:58 pm |
|
Do you want the right blocks to be hidden too? |
_________________ Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jane65
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jun 10, 2014 4:56 pm |
|
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](modules/Forums/images/smiles/icon_smile.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
nuken
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jun 10, 2014 5:53 pm |
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jane65
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jun 13, 2014 2:29 am |
|
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](modules/Forums/images/smiles/icon_smile.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|