Hi there,
I have a simple two column template with the main content floated left and the right column floated right. I just wanted to know how I can extend the width of the main content if there is no content in the right.
Would I need to use if/else statements?
I suppose it could easily be done my using a new template for the full width content, however, this doesn’t seem like a streamlined approach.
Thanks
Lee
The easiest way is the two template way.
At the end of the day, the only thing you’re duplicating is about 5kb or whatever of HTML. All images and javascript files called in both templates will be cached, so visiting one template where they’re used will add them to your browser’s cache, and then visiting the other page - even though the HTML is different - will load those files from your browser’s cache.
I don’t think it’s worth trying to find a more complicated way around it to be honest.
Thanks Pete, it is the easiest option and as you mention, plus its the most flexible too.
Thanks
Lee
-
MODX Staff
- 10,725 Posts
Actually, easiest way with one template would be to use <body id="[(alias)]"> or maybe body id="[*layoutTV*] and then use the document alias (or a custom TV called layoutTV) to set the body id of the page. You can then use those specific body id’s to customize the CSS for those pages. Use @INHERIT and you could set this by section/folder.