[Nitro] Tempalte hack and feature requet

James Britt james_b at neurogami.com
Mon Apr 4 23:32:00 EDT 2005


I was wondering about doing a conditional  header include, so that each 
page in a Web site can have a common set of links , but not link back to 
itself.


Here's a simple example, where the index page doesn't need a link to 
itself.

# file header.xhtml -----

   <?r
     today = Time.now.strftime( "%A, %d %B, %Y")
     links = "<a href='/'>My Blog</a>"
     links  = "My Blog"  if caller[6] =~ /index/
   ?>
   <div id='header'>
     <h1>#{links}</h1><h3>Today is #{today}</h3>
   </div>

# end file  -----

This gets included into index.xhtml, and other pages, and manages to 
detect the calling xhtml page.  But it feels hackish, and wonder if 
there was, or could  be, a cleaner way for one file to know what parent 
page was including it.

Thanks,

James

-- 

http://www.ruby-doc.org
http://www.rubyxml.com
http://catapult.rubyforge.com
http://orbjson.rubyforge.com
http://ooo4r.rubyforge.com
http://www.jamesbritt.com



More information about the Nitro-general mailing list