Jump to content

how to hide left and right columns in index page


Recommended Posts

hello everyone.

 

i want to hide left and right column in the index page only. i try to hide it by css but then its not displing at other pages too i mean in products page etc

below is my globle.css if someone can help.

 

Thanks

 

#left_column {

margin-right: 9px;

overflow: hidden;

width: 188px;

float: left;

display: block;

}

#center_column {

overflow: hidden;

width: 547px;

float: left;

margin-top: 0;

margin-right: 0;

margin-bottom: 30px;

margin-left: 0;

}

#old_center_column { display: none }

#index, #left_column, #right_column { display: none }

 

#right_column {

width: 188px;

margin-left: 9px;

overflow: hidden

}

 

 

 

here is the website when i have this problem

 

http://www.nonrestaurantshop.es

Link to comment
Share on other sites

hello everyone.

 

i want to hide left and right column in the index page only. i try to hide it by css but then its not displing at other pages too i mean in products page etc

below is my globle.css if someone can help.

 

Thanks

 

#left_column {

margin-right: 9px;

overflow: hidden;

width: 188px;

float: left;

display: block;

}

#center_column {

overflow: hidden;

width: 547px;

float: left;

margin-top: 0;

margin-right: 0;

margin-bottom: 30px;

margin-left: 0;

}

#old_center_column { display: none }

#index, #left_column, #right_column { display: none }

 

#right_column {

width: 188px;

margin-left: 9px;

overflow: hidden

}

 

 

 

here is the website when i have this problem

 

http://www.nonrestaurantshop.es

 

you can do this in your template and check is that home page if that home page or index than hide that.

 

like bellow :

{if $page_name == 'index'} {/if>

Link to comment
Share on other sites

i found this at header.tpl , and i removed this line too. but now still i can not <div id="center_column" {if $page_name == 'index'} style="width: 945px;"{/if}> now still i can not see left and right column at products and category pages.

 

you can view that in layout.tpl which maintain that. hope that will work .

Link to comment
Share on other sites

you can do this in your template and check is that home page if that home page or index than hide that.

 

like bellow :

{if $page_name == 'index'} {/if>

 

Just to clarify -- this is going to show the left and right columns on the 'index' page. You will need to add

{if $page_name != 'index'} {/if>

 

This will show the left and right columns on all pages EXCEPT for the 'index' page.

 

Hope that helps!

 

Marty Shue

Link to comment
Share on other sites

sorry it didnt worked for me .

 

below is the code for header.tpl

 

<div id="header_right">

{$HOOK_TOP}

</div>

<div style="clear:both"></div>

</div>

{if $page_name != 'index'}

<div id="columns">

<!-- Left -->

<div id="left_column" class="column">

{$HOOK_LEFT_COLUMN}

</div>

{/if}

<!-- Center -->

<div id="center_column" {if $page_name = 'index'} style="width: 945px;"{/if}>

{/if}

Link to comment
Share on other sites

I think this is more what you are looking for

 

<div id="header_right">
{$HOOK_TOP}
</div>
<div style="clear:both"></div>
</div>
<div id="columns">
{if $page_name != 'index'}
<!-- Left -->
<div id="left_column" class="column">
{$HOOK_LEFT_COLUMN}
</div>
{/if}
<!-- Center -->
<div id="center_column" {if $page_name = 'index'} style="width: 945px;"{/if}>

 

That should hide the left column on the homepage.

 

Remember to remove the display: none in the CSS from your original post.

 

Marty Shue

Link to comment
Share on other sites

the reason its not working for you is because for some reason you home page as no name 'Index', it's blank.

So maybe you can try: {if $page_name != ''} instead.

 

 

Also you have the same problem with the right column that you need to hide at home page so you should use the same code in footer.tpl as well.

 

Also I suggest you to try not to hide the columns (right & left) at home page but instead to exclude the home page from those modules, you can do it in BO -> modules -> positions, look for the modules on left/right columns -> edit them and exclude them from index.

 

Good luck

Edited by yaniv14 (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...