Page 1 of 1
Show/hide columns and add id/class on body tag
Posted: Thu Oct 14, 2010 12:11 am
by danbalbo
Hey all,
i would like to hide selectively, on page basis, the right and/or left column. How can i achieve this in opencart 1.4.8 without modyfing the controller?
It would be also nice to add an ID or CLASS on the body tag for every page so to customize the layout of each page by css. is it possible?
Re: Show/hide columns and add id/class on body tag
Posted: Thu Oct 14, 2010 6:44 am
by JAY6390
To add a unique div based on the page, put
Code: Select all
<body id="<?php echo empty($this->request->get['route']) ? 'common-home' : str_replace('/', '-', empty($this->request->get['route'])); ?>">
This will give for example
product-category as the id for the product/category route,
common-home for either the default home page url or the route common/home
pretty self explanatory
then to hide the columns on that page, use css with the id and the column selector setting display:none
Re: Show/hide columns and add id/class on body tag
Posted: Thu Oct 14, 2010 9:18 am
by imaginetech
Have a look at jquery, things like:-
$('.#column_right').hide()
Are quick ways to hide content whilst other methods allow you to resize div etc to get the layout you want.
Re: Show/hide columns and add id/class on body tag
Posted: Fri Dec 24, 2010 9:00 am
by msblack7of9
Hi Jay6390, can you clarify your solution? I was able to get a body id for my homepage but not the rest of the pages. I used this coding you put:
<body id="<?php echo empty($this->request->get['route']) ? 'common-home' : str_replace('/', '-', empty($this->request->get['route'])); ?>">
I don't know what to add to this coding for the rest of the pages. Thanks!
7:)
Re: Show/hide columns and add id/class on body tag
Posted: Tue Mar 15, 2011 7:07 am
by adriatiq
<body class="<?php echo empty($this->request->get['route']) ? 'common-home' : str_replace('/', '-', $this->request->get['route']); ?>">
This works.
Re: Show/hide columns and add id/class on body tag
Posted: Tue Mar 15, 2011 7:03 pm
by msblack7of9
ok thanks i'll try it.
Re: Show/hide columns and add id/class on body tag
Posted: Tue Mar 15, 2011 11:24 pm
by openmycart.com
Code: Select all
<body id="<?php echo empty($this->request->get['route']) ? 'common-home' : str_replace('/', '-', empty($this->request->get['route'])); ?>">
VS
Code: Select all
<body class="<?php echo empty($this->request->get['route']) ? 'common-home' : str_replace('/', '-', $this->request->get['route']); ?>">
