# Different layouts between list and view pages?

**URL:** <https://www.ruby-forum.com/t/different-layouts-between-list-and-view-pages/96503>\
**Category:** Radiant CMS\
**Created:** [June 29, 2006, 3:00am UTC](https://www.ruby-forum.com/t/different-layouts-between-list-and-view-pages/96503 "2006-06-29T03:00:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kyleh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a9a28c/32.png) [@kyleh](https://www.ruby-forum.com/u/kyleh)\
**Post date:** [June 29, 2006, 3:00am UTC](https://www.ruby-forum.com/t/different-layouts-between-list-and-view-pages/96503/1 "2006-06-29T03:00:04Z")

</div>

I’m using the demo site to help me port my Typo site into Radiant. To  
make  
this even more complicated I’m retrofitting the popular Hemingway theme  
for  
my needs. Because this theme has a different view for the detail page I  
need  
to get Radiant to use a different template when a specific article has  
been  
selected but to default to the article list layout otherwise.

I’m unsure how to do this. Any tips? Thanks.

Kyle H.  
removed\_email\_address@domain.invalid  
[www.kyleheon.com](http://www.kyleheon.com)

---

<div class="post-metadata">

**Author:** ![kyleh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a9a28c/32.png) [@kyleh](https://www.ruby-forum.com/u/kyleh)\
**Post date:** [June 29, 2006, 3:09am UTC](https://www.ruby-forum.com/t/different-layouts-between-list-and-view-pages/96503/2 "2006-06-29T03:09:13Z")

</div>

Kyle H. wrote:

> I’m using the demo site to help me port my Typo site into Radiant. To make  
> this even more complicated I’m retrofitting the popular Hemingway theme for  
> my needs. Because this theme has a different view for the detail page I  
> need  
> to get Radiant to use a different template when a specific article has been  
> selected but to default to the article list layout otherwise.
> 
> I’m unsure how to do this. Any tips? Thanks.

There is not a clean way to do this. You could put the templates in  
snippets and then use \<r:if\_url matches=“…” /\> to select the proper  
snippet depending on the URL.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![kyleh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a9a28c/32.png) [@kyleh](https://www.ruby-forum.com/u/kyleh)\
**Post date:** [June 29, 2006, 7:07pm UTC](https://www.ruby-forum.com/t/different-layouts-between-list-and-view-pages/96503/3 "2006-06-29T19:07:53Z")

</div>

Why not do it through css?

 - or the URL equivalent (unsure of the code for that) and then specify an ID in your css for each unique page. That would produce really specific ID's, perhaps you could use another, less specific tag if you need something targeted to a group of pages.

Then in CSS you’d do something like:

#another-day .content{  
font-size: 1.5em;  
}

This is my first post to the list, I’ve been using/theming Drupal for  
the past few years and I’ve found Radiant to be a great tool for my  
needs! Anyway, I’d do something like this in Drupal, so I would think  
the same logic would apply to Radiant.

Erik M.

---

<div class="post-metadata">

**Author:** ![kyleh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a9a28c/32.png) [@kyleh](https://www.ruby-forum.com/u/kyleh)\
**Post date:** [June 29, 2006, 9:29pm UTC](https://www.ruby-forum.com/t/different-layouts-between-list-and-view-pages/96503/4 "2006-06-29T21:29:30Z")

</div>

It depends on how different he wants the page to be, if he’s providing a  
completely separate layout, he’d need to provide a completely different  
css page. I’ve been thinking of the best way to provide a print version  
for every page, and one of the ways was to use the if\_url command to  
switch css files. Though it ended up being completely useless for me, it  
would probably work well in this circumstance. You wouldn’t even  
actually need a snippet if you’re providing css files, in the template  
(or where ever you call the stylesheet) use:

\<r:unless\_url matches="/[your archive  
directory]/\d{4}/\d{2}/\d{2}/.+"\>[your normal stylesheet]\</r:unless\_url\>  
\<r:if\_url matches="/[your archive directory]/\d{4}/\d{2}/\d{2}/.+"\>[your  
article specific stylesheet]\</r:if\_url\>
