removing sidebar from a single page

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
beeswax

removing sidebar from a single page

Post by beeswax »

using CMSMS v.1.0.4 to develop a site and the template CSSMenu top + 2 columns, which has the sidebar with content tags. On a couple of pages I need to display items full width, without the sidebar. My idea was to copy the CSSMenu top + 2 columns template, comment out the sidebar, attach stylesheets and set it as the template for those pages where I didn't want a sidbar...and that's where it went horribly wrong. Am I on the right track or a complete screw up?
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: removing sidebar from a single page

Post by RonnyK »

Beeswax,

if you copy the template and then delete (or comment out) the DIV for the column you want to disappear, it should work. You might also, delete the two divs that now divide the content and only have your content DIV left. I commented the lines in RED, I think you can comment out. This way you don't have to change any other stylesheet or what so-ever. The only additional thing is a template with the same attached stylesheets as the original.
   
   

     
     
         {content block='Sidebar'}
     
     


     
     
         {print showbutton=true script=true}
         {title}
         {content}


         


{anchor anchor='main' text='^ Top'}

         
            {cms_selflink dir="previous" label="Previous page: "}

            {cms_selflink dir="next"}
         
         


     
     
 


   
   
By doing this you don't have to spread the remaining div over the page as both divs are wrapped inside the div content.

Otherwise you only delete the div for sidebar, and additionally change the width of the css for the remaining DIV main to margin-left 0% and margin-right 0%, to keep the original styling for the DIV main. Both methods should work, maybe this last one is the best/easiest.

Ronny
Last edited by RonnyK on Thu Mar 01, 2007 3:16 pm, edited 1 time in total.
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

Re: removing sidebar from a single page

Post by kermit »

the easy way, without making a new template....

flip-flop {stylesheet} and {metadata} in the 'CSSMenu top + 2 columns' template, so that {stylesheet} comes FIRST.

in the meta data (option tab) for the page you want as one column, add:

{literal}

div#sidebar {display:none;}
div#main {margin-left:2%;}

{/literal}

note that this method will not eliminate the sidebar content block, just hide it from display; and the sidebar content block editing window will still appear on the page editing pages. that content, if any, will still be in the output source, it just won't be shown on the screen if the above styles are applied to a page.


OR, you can duplicate the template and make the necessary edits:

1. copy the template 'CSSMenu top + 2 columns'
2. copy the stylsheet 'Layout: Top menu + 2 columns'
3. add the following to the end of the newly created copy of the stylesheet (or find the right place within the css and make the edit instead, but just adding this to the end of it is easier):

div#sidebar {display:none;}
div#main {margin-left:2%;}

4. template/css association: remove the 'old' stylesheet from the new template, add the 'new' stylesheet to it instead.
5. edit the new template (not absolutely required, but doing so will remove the now useless sidebar content block while editing this particular page), remove the following from it:

     
     
        {content block='Sidebar'}
     
     

5a: if you edit the template as above, you only need the 2nd line in 3. added to the end of the 'new' stylesheet.
6. assign the one-column page the new template.

note the margin-left can be whatever you want.. 1em, 2em, 2%, etc..  the value here is how far from the left edge the page content will be. 2% looks fine here on a window up to 1280px wide (the maximum resolution of my screen)
Last edited by kermit on Thu Mar 01, 2007 3:50 pm, edited 1 time in total.
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
Locked

Return to “CMSMS Core”