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

[eluser]andrewtheandroid[/eluser]
[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.


Messages In This Thread
Best practice to including sidebar on some pages, but not all? - by El Forum - 11-06-2009, 03:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB