# Navigation and using Snipets for global variables

**URL:** <https://www.ruby-forum.com/t/navigation-and-using-snipets-for-global-variables/98687>\
**Category:** Radiant CMS\
**Created:** [July 17, 2006, 2:56pm UTC](https://www.ruby-forum.com/t/navigation-and-using-snipets-for-global-variables/98687 "2006-07-17T14:56:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harvey\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/13edae/32.png) [@Harvey\_B](https://www.ruby-forum.com/u/Harvey_B)\
**Post date:** [July 17, 2006, 2:56pm UTC](https://www.ruby-forum.com/t/navigation-and-using-snipets-for-global-variables/98687/1 "2006-07-17T14:56:19Z")

</div>

Hi guys

On my home page I have a page part called menubar which uses the  
following  
snipet.

- 

This displays the main navigation and works well. I only have one issue  
with it. I would like to highlight to the user which section they are  
currently in. The CSS has been setup so all I actually need to do is  
something like this, by just using the class = “on”:-

- Extranet

At the moment, I am thinking about having to create separate menubar  
snippets for each section and using some kind of if statement. Is there  
a  
simple way to do what I need?

My next question relates to using snippets as global variables. I  
wanted to  
create a snippet called CompanyName. I wanted this snippet to use  
textile  
and simple be the company name e.g. _Company Name_. I figured that if  
the  
company named changed it would be child’s play to change it throughout  
the  
website.

The only problem is that when I call the snippet it adds a line break  
which  
is no good as it would be typically put into regular paragraphs. Is  
there  
anyway to achieve global variables for a website?

Thanks in advance  
Harvey

This e-mail has been scanned for all viruses by MessageLabs.

---

<div class="post-metadata">

**Author:** ![Harvey\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/13edae/32.png) [@Harvey\_B](https://www.ruby-forum.com/u/Harvey_B)\
**Post date:** [July 17, 2006, 5:36pm UTC](https://www.ruby-forum.com/t/navigation-and-using-snipets-for-global-variables/98687/2 "2006-07-17T17:36:20Z")

</div>

Harvey B. wrote:

> This displays the main navigation and works well. I only have one issue  
> with it. I would like to highlight to the user which section they are  
> currently in. The CSS has been setup so all I actually need to do is  
> something like this, by just using the class = “on”:-
> 
> - Extranet

There seem to be two approaches to this. The first is to use the  
\<r:navigation /\> tag as described in part 2 of the Tag Primer:

[http://radiantcms.org/blog/2006/06/15/tag-primer-2/](http://radiantcms.org/blog/2006/06/15/tag-primer-2/)

The second is to use slugs in combination with id elements as Randy  
Heneise covers in his article on Radiant:

[http://artofmission.com/articles/2006/06/06/radiant-cms](http://artofmission.com/articles/2006/06/06/radiant-cms)

> My next question relates to using snippets as global variables. I wanted to  
> create a snippet called CompanyName. I wanted this snippet to use textile  
> and simple be the company name e.g. _Company Name_. I figured that if the  
> company named changed it would be child’s play to change it throughout the  
> website.
> 
> The only problem is that when I call the snippet it adds a line break which  
> is no good as it would be typically put into regular paragraphs. Is there  
> anyway to achieve global variables for a website?

Not at the moment. The best you can probably do is to use a snippet  
without a filter applied to it. Textile and Markdown both put paragraph  
tags around content that appears on a line by itself.

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