Hi,

How to set page-width of a particular page say www.xyz./com/apage

Suppose default width of a page in theme style CSS file is 600px, then how and where it can be overriden for a single page(or a set of pages) ?

??? If you know please help.

Comments

callison’s picture

One option to consider is changing the template.php and page.tpl.php files. You could check for some values in a template.php file preprocess function (i.e. if you're on www.xyz.com/apage) and set a variable to True or False. Then, in your page.tpl.php file you can check if that variable is true, if so, print a wrapper div for the page and in your style.css file, change the width of that wrapper to whatever you like.

For an example of this, check out the a3_atlantis theme. They may have done it differently then what I just described, but they have an option on the admin pages to increase the page width. Hope this is helpful.

Check out the Theming Guide for more help.

new2drupal99’s picture

Very thanks for your help.

But after using and analyzing a3_atlantis theme, I am unable to achieve my needs.

Actually, In style CSS

body {
background-color:#f0f0f0;
padding:0 10px 0 10px;
margin: 0 auto;
width: 665px; /* with left-sidebar( 135px ) the total page width will be 800px)
}

and after using left side bar the total page width is 800px. And when I don't need left sidebar(disabling from block) for any particular page, then the total page width becomes 665px and here comes the problem. Even if there is no left-sidebar, I need the total page width should be 800px, how?

??? Please give some hint/help.

Thanks.

callison’s picture

I think it will be a similar concept to my first post. You will need to have some html that is displayed based on some criteria (i.e. whether the sidebar is displayed or not). For example, you could insert a new class to the body tag or something with only that class specified in CSS as 800px. Hopefully this makes sense.

[edit] Another good theme to examine is the Aquia Marina theme. They have several blocks where the layout changes based on how many are displayed (check out the preface blocks especially).[/edit]

john.kenney’s picture

you can do this several ways. one is as allison suggests which is to figure out a way to add a specific class to the page template or some php code somewhere.

another way that might be simpler since it sounds like you are doing this on fairly specific set of pages is to simply manually add the class within the body field of the actual page you want wider. this requires that you've manually or otherwise disabled the blocks. and it requries fiddling with the CSS to get the positioning right.

here is an example page where i did this: http://www.callingwashingtondc.com/default.htm?C=Hotels&N=&L=Washington%...

you'll see a class=superpages inside the main 'content' part of the node. this was manually entered in teh normal body edit field.

the associated CSS to position it and get the wider width compared to other nodes on my site is

.node .superpages {
  margin-left: -260px;
  width: 990px;
  height: 3550px;
}

depending on your other CSS, you may only require the width property.