Post by itrends » Tue Jul 21, 2009 4:38 am

Hey all, could anyone provide me with the IF statement code I would need to use to selectively hide the right hand sidebar if on the homepage of the site? :)

Thanks!

Active Member

Posts

Joined
Tue Jul 14, 2009 7:54 pm

Post by readyman » Wed Jul 22, 2009 11:01 pm

In layout.tpl view file, where the right column currently appears.

This should work for now...

Code: Select all

<?php if(sizeof($breadcrumbs) > 1) { //On the homepage ?>
  <div id="column_right">
    <?php foreach ($modules as $module) { ?>
    <?php if ($module['position'] == 'right') { ?>
    <?php echo ${$module['code']}; ?>
    <?php } ?>
    <?php } ?>
  </div>
<?php } ?>
This assumes you haven't touched the breadcrumbs code.

http://www.alreadymade.com
Follow me on twitter.com/alreadymade


User avatar
Global Moderator

Posts

Joined
Wed May 20, 2009 5:16 am
Location - Sydney

Post by mbeerden » Sun Dec 20, 2009 7:16 pm

I want to remove the right sidebar from my OC install. But i cant find the file layout.tpl

i have looked in my folders but it isn't located in:

catalog/view/theme/default/template/common/

Can anyone help me?

New member

Posts

Joined
Tue Nov 03, 2009 5:06 am

Post by huhitschris » Sun Dec 20, 2009 7:48 pm

mbeerden wrote:I want to remove the right sidebar from my OC install. But i cant find the file layout.tpl
layout.tpl is no longer used in the latest version of opencart, so you're not going to find it...

locate and open the following file:

...\catalog\view\theme\default\template\common\home.tpl

Find this code and delete it or comment it out:

Code: Select all

<?php echo $column_right; ?>
itrends wrote:Hey all, could anyone provide me with the IF statement code I would need to use to selectively hide the right hand sidebar if on the homepage of the site? :)
Find the same piece of code used above and wrap an IF statement around it:

Code: Select all

<?php if($showColumnRight){ echo $column_right; }?>
*Note: You will need to do the same thing to the rest of your template files in order for this to apply to all pages, not just the home page.

PM me for custom OpenCart template design and development.


New member

Posts

Joined
Wed Aug 19, 2009 3:12 pm

Post by mbeerden » Tue Dec 22, 2009 4:08 am

this worked very good for me! Thank you very much for the help!

Have a merry christmas!

New member

Posts

Joined
Tue Nov 03, 2009 5:06 am

Post by imaginetech » Tue Dec 22, 2009 8:37 am

My 2 cents,

Wasn't the column left and column right redesign changes added so that we could easily drop the left or right columns from any page without having to use conditional statements?

Yet, if I was to drop the right side column from one page only wouldn't I need conditional statements to resize the remaining content to actually fit "properly"?

Unless I'm missing something all I can see is that the changes still require conditional comments either previously to handle the php or currently to handle the css.

Wait! Yes you could use % based layouts but that in itself would cause issues with product rows and number of products etc.

I'd really like to hear other members thoughts on this one.

Image
www.opencartstore.com
Get OpenCart Templates and OpenCart Modules.


User avatar
Active Member

Posts

Joined
Fri Sep 04, 2009 12:25 pm
Location - Darwin, Australia

Post by Qphoria » Tue Dec 22, 2009 8:47 am

imaginetech wrote:so that we could easily drop the left or right columns from any page without having to use conditional statements?
I guess "easily" is subjective. But you are correct. I guess you can't teach old dogs new tricks :)

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by wedhaaf » Tue Dec 22, 2009 10:12 am

And it will more easier if user can control the layout from admin page. What user do is just to "activate" left sidebar, or right sidebar.

New member

Posts

Joined
Mon Oct 27, 2008 3:10 pm

Post by Qphoria » Tue Dec 22, 2009 10:23 am

Things get real ugly when themes start getting controlled from the admin. ZenCart started doing it and it caused extreme confusion when working with templates because you can design a template a certain way using the CSS to properly handle the dimensions, but then zencarts admin area lets you resize the table widths which then override the css and breaks the hell out of things. I think the way it is now is still iffy, but best to keep the majority in the view area for tpl and css files

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by moggiex » Tue Dec 22, 2009 10:57 pm

imaginetech wrote:I'd really like to hear other members thoughts on this one.
This is easy, leave the template files well alone, don't put any modules in the right nav bar and then set its width to 0px in the CSS (display: hidden; too if you're paranoid you might be dealing with a nub), then make the centre bar wider, its something like 740px off the top of my head for a standard 960px OpenCart store.

Matt

Code: Select all

It was like that when I found it, honest!


User avatar
Active Member

Posts

Joined
Mon Nov 09, 2009 9:55 pm

Post by moggiex » Tue Dec 22, 2009 10:59 pm

Oh and if you're doing it in reverse for the left nav bar, do the same, but make sure you put right side padding on the centre and right bars of 10px otheriwise they start to look awkard.

But sites should be based on left bar navigations, not right, its just bad Internet navigation to do so.

Matt

Code: Select all

It was like that when I found it, honest!


User avatar
Active Member

Posts

Joined
Mon Nov 09, 2009 9:55 pm

Post by huhitschris » Wed Dec 23, 2009 7:51 am

Qphoria wrote:I think the way it is now is still iffy, but best to keep the majority in the view area for tpl and css files
Agreed.

Also it might be easier to have these statements included once in the header or footer rather than to echo them at the top of every template file. Displaying them on a per-page basis would only require re-inserting the statements as needed.

PM me for custom OpenCart template design and development.


New member

Posts

Joined
Wed Aug 19, 2009 3:12 pm

Post by imaginetech » Wed Dec 23, 2009 8:53 am

moggiex wrote:
imaginetech wrote:I'd really like to hear other members thoughts on this one.
This is easy, leave the template files well alone, don't put any modules in the right nav bar and then set its width to 0px in the CSS (display: hidden; too if you're paranoid you might be dealing with a nub), then make the centre bar wider, its something like 740px off the top of my head for a standard 960px OpenCart store.

Matt
Hi Matt,

This works if the right column is not needed throughout the site. What I was talking about is when you just want a single page to not display the right column but all other pages to display the column or to extend it further 50% do and 50% don't.

This was one of the touted features of the new template system (not requiring conditional php statements to display content selectively). However I think we've just changed one set of conditional statements for another.

Image
www.opencartstore.com
Get OpenCart Templates and OpenCart Modules.


User avatar
Active Member

Posts

Joined
Fri Sep 04, 2009 12:25 pm
Location - Darwin, Australia

Post by moggiex » Wed Dec 23, 2009 9:21 am

imaginetech wrote: Hi Matt,

This works if the right column is not needed throughout the site. What I was talking about is when you just want a single page to not display the right column but all other pages to display the column or to extend it further 50% do and 50% don't.

This was one of the touted features of the new template system (not requiring conditional php statements to display content selectively). However I think we've just changed one set of conditional statements for another.
Ah I hear ya, the best use of this would be product pages, where you drop one or both of the side bars.

A great example of this is http://www.ebuyer.com/ to http://www.ebuyer.com/store/Sound-&-Vis ... ertainment to http://www.ebuyer.com/product/175291

And another use of it is in the checkout, dump the side bars as they detract from the purpose of that page and limit the number of links to get out of it, it would need to be conditional, however pretty easily done, check the url for product or checkout and alter the page accordingly.

Not sure how it was thought it was not going to be a conditional statement job, if there is no admin for side bars in the administration area of OpenCart?

Matt

Code: Select all

It was like that when I found it, honest!


User avatar
Active Member

Posts

Joined
Mon Nov 09, 2009 9:55 pm

Post by pepegarcia » Wed Jan 27, 2010 2:05 am

Hi!

I'm trying to remove the right column and do center column wider. I tryed with the css files in my default theme, changing this:
- On stylesheet.css:

#column_right {
float: right;
width: 0px;
margin-left: 0px;
clear: right;
}
#content {
float: left;
width: 710px; /*Modificado*/
margin-bottom: 10px;
}
#content .top {
padding: 8px 0px 6px 10px;
background: url('../image/content_top.png') no-repeat;
width: 710px; /*Añadido*/
}
- On ie6.css:
/*
#column_right {
width: 0px;
float: right;
margin-left: 0;
}
*/
/* convert min height values */
#content {
width: 710px;
margin-left: 0;
margin-right: 0;
}
#content .top .center {
margin-left: 0px;
margin-right: 0px;
padding: 0px;
float: left;
width: 570px;
}
#content .middle {
width: 710px;
overflow: hidden;
}

But no changes. I have no knowleges of php or css, could anyone give me a hand on this please?
Thanks!!

Newbie

Posts

Joined
Wed Jan 27, 2010 1:29 am

Post by George Kinsman » Fri Jan 29, 2010 3:58 pm

This should fix it.

#content {
margin-left: 190px;
margin-right: 0px; /* Changed from 190px to remove right sidebar */
margin-bottom: 10px;
}


Posts

Joined
Fri Jan 29, 2010 3:57 pm

Post by francoisv » Tue Feb 15, 2011 3:24 am

Thx George
Worked 100%

New member

Posts

Joined
Thu Nov 04, 2010 5:08 pm
Who is online

Users browsing this forum: No registered users and 39 guests