Hi All,

i am working on a site for a community group (unpaid) that will mostly be static content with a members only area for latests news (like a blog), so want no blocks visible on most pages/most of the time (i have seperate navigation). i am a little stuck with this!

I know i can turn off blocks on certain pages and will be doing this - what i want is to have the second column (side bar) in my two column layout not be visible at all when the blocks are hidden/turned off (i.e. on these essentially static pages).

Specifically i want the site to be one column except for say the admin, user/login and add content pages.

I could make the static pages outside of drupal to over come this and have a part drupal site, though i want the option of authenticated members to be able to edit this essentially static content within drupal rather than source code/html - so they can 'own' the site and not rely on me or another coder to add/modify content.

Drupal 4.7 may (i have only word of mouth knowledge of the regions property) overcome this, or i could put the blocks at the top/bottom of the main content, tho would prefer to have them selctively in a sidebar and then the main column fill out the page (i.e. expand to 100% page width) when the blocks are hidden.

I am certain the solution is a simple css thing, though cannot think how to do it... or is there something in drupal?

any help would be greatly appreciated.

thanks

c.

Comments

Samat Jain’s picture

Steven Wittens' presentation on Drupal theming has a tidbit on how to accomplish this with Drupal and CSS. I'll let you find the magical slide rather than disclosing it here.

Besides that, you can look at his friendselectric theme or my sands theme (both CSS) for inspiration.
__
My Drupal websites: Personal home page | Rhombic Networks: specialized Drupal application hosting

avolve’s picture

i had looked at Steven Wittens' presentation before, though do not really have that much time to work through it (or this site) and it seems that the css/coding is substanital work.

I assume that the negative left margin on the float: right and the negative right margin on the float: left play a part though cannot see them at all in the page.tpl.php file (am a php novice with limited understanding except based on my old coding/programming days before php).

Does the lack of content (i.e. hidden blocks) lead to the slide - i am not clear on how this would work as the negative margin equals the width of the sidebar (my limited css knowledge i assume).

Your coding seems esier to follow, yet I am not clear on the structure of your page.tpl.php - why is the right column outside the SOWrap?

Any chance you could give me some detail/help on this? you send me a PM if you won't want to let the cat out of the bag... (i hope i haven't givent too much away - and thanks for the reply!) i would really appreciate it!

thanx
c.

[edit] i am staring to understand the concept (enough i hope) behind your design. i will let you know if i can get it working - i like the htought process behind it!

avolve designs | ethical by design

Samat Jain’s picture

With the negative margin method used by friendselectric and sands, there are four different CSS rules for the outer container, one for each of: both sidebars, left sidebar only, right sidebar only, no sidebar. Each defines a different set of margins--you don't need a certain margin if there will be no sidebar there.

page.tpl.php contains code for selecting which CSS rules will be applied, depending on what sidebars are enabled for a page.

In sands, the right column is outside the SOWrap element to provide the 3-column layout. I did not design this, I borrowed it from a layout available on the Internet (see columns.css for attribution). With sands, at least, you can remove the rest of the stylesheets except columns.css, so you can see how the CSS columns by themselves work.

__
My Drupal websites: Personal home page | Rhombic Networks: specialized Drupal application hosting

saerdna’s picture

your template and css may look as follow:

#sidebar { float:right; width 200px; }
#content { margin-right: 200px; }

<div id="sidebar">
<?php print $sidebar_right; ?>
</div>
<div id="content">
 content goes here..
</div>

no what you want to do is something like this

#sidebar { float:right; width 200px; }
#content-with-sidebar { margin-right: 200px; }
#content-without-sidebar { .... }

<?php if($sidebar_right) { ?>
<div id="sidebar">
<?php print $sidebar_right; ?>
</div>
<?php } ?>
<div id="content<?php (($sidebar_right) ? '-with-sidebar' : '-without-sidebar' ) ?>">
 content goes here..
</div>
avolve’s picture

in page.tpl.php i have used the above code (very similar), yet the php above does not seem to work. i have used this:

<div id="content <?php (($sidebar_right) ? '-with-sidebar' : '-without-sidebar' ) ?> ">

and when i view source i get

<div id="content  ">

[note the space]

rather than

<div id="content-with-sidebar">

or

<div id="content-without-sidebar">

anyone see any syntax errors or other problem with the php?

alternate ideas solutions?

avolve designs | ethical by design

Heine’s picture

There's no output from the equation; add a print statement.

--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.

avolve’s picture

here is a solution that works - had a quick chat with a friend and came up with this

<div id="<?php if($sidebar_left) {echo 'maincolumn-with-sidebar';} else {echo 'maincolumn';} ?>">

avolve designs | ethical by design