Page 1 of 1

[resolved] Pulling in a variable name

Posted: Tue Dec 09, 2008 6:00 pm
by doodlebee
Hello all - I have another question, if you don't mind me asking :)

I have a conditional (using custom tags that I found in this wonderful forum to get the page alias and position in hierarchy) that looks like so:

     {if $root_page_hierarchy == '1'}
       {content}
     {else}
        {global_content name='category_'$root_page_alias}
     {/if}

And of course, it's not working.  If I place the "$root_page_alias" within the quotes, then it *literally* looks for "$root_page_alias".  Outside the quotes, it completely ignores it.  Either way, it tosses out an error because it can't find that content block.

I know if I were writing this as PHP it would be:

if ($root_page_hierarchy == '1')
  echo $content;
} else {
  echo 'category_' . $root_page_alias;
}

and the last part would echo out (saying the page I'm on is "shoes") 'category_shoes'.

Is there a way to do this using the Smarty tags?  I just can't seem to get it to recognize the $root_page_alias as part of the name I want.  Thanks so much for any pointers you can pass!

Re: Pulling in a variable name

Posted: Tue Dec 09, 2008 6:02 pm
by doodlebee
Oh.  My.  God.

I'm an utter idiot.  (I think I said that yesterday too LOL - now I'm just verifying it!)

let's just say "nevermind" because it *is* working.  My mistake - I'd put in 'category_$root_page_heirarchy'.  When I changed it (DUH) to 'category_$root_page_alias' it put out what I wanted.

Someone spank me with a wet noodle for not paying attention to myself.  Sorry to take up server space!