Welcome Guest, Not a member yet? Register   Sign In
Best practice to including sidebar on some pages, but not all?
#11

[eluser]jleequeen[/eluser]
[quote author="lane4" date="1257563817"]Maybe make your sidebar float to the right using css. Main div should be able adjust.

Code:
.sidebar {
    float: right;
}
[/quote]

I like the idea of this, but I've had bad luck with float clearing working in all browsers. Sometimes I think it's easier to do a two column table that never breaks, but I know that's going backwards about 10 years, lol.
#12

[eluser]jleequeen[/eluser]
[quote author="andrewtheandroid" date="1257564615"][quote author="jleequeen" date="1257563453"]Thanks for your suggestions. I understand how that would work. My problem is, when I want to switch from a full column to a smaller column with a sidebar wouldn't I need to also change my css? Do you have some decision logic to show different main column div's if you want a full width view versus a smaller one with a sidebar?[/quote]

Hey jleequeen I use the above approach mentioned. In my template inside the header I allow for additional stylesheets to be called so a particular view can overide the global.

Inside template
Code:
<html>
<head>
<? if(isset($stylesheets)): // Check for specified sheets
foreach($stylesheet as $sheet): // Create the link for each one ?>
<link href="<?=base_url()?>css/<?=$sheet?>.css" ....etc>//Sheet is the filename
<? endforeach; endif; ?>
</head>

<body>
  <div id="sidebar"></div>// iffset sidebar as above
  <div id="content"></div>// iffset content (if not show default content
&lt;/body&gt;
&lt;/html&gt;

then as above with the $data['content'] I also set
Code:
// Pass stylesheets into override style
$data['stylsheets'] = array('mystyle','secondStylesheet','morestylesheet');
then pass this into the view with the content.

Then you could use css to style the sidebar to your liking.[/quote]

Nice solution. I'll have to add that to my layout.




Theme © iAndrew 2016 - Forum software by © MyBB