22881 Posts in 9904 Topics by 2805 members
|Go to End|
27 June 2013 at 11:04pm
I've done a search of the forums for an answer to this, and found a couple of answers that look like they should work, but so far I've not had any joy with this issue.
Long story short, My site is split into several different sections (listed as the main navigation across the top of the page). Within any one section, I want the side navigation to show the 2nd and 3rd levels of links within that section.
So far so good, this is working just fine thanks to the following code:
The issue I'm having is that one of the sections on the site has a hell of a lot of level 2 and level 3 links, so when within that section, I only want the level 2 links to display.
I figured that seeing as this section is going to be using custom page types, I would be able to test for the page type, and disable the 3rd level from displaying, i.e.:
<% if $ClassName = "CourseBase" %>
// don't show anything
<% else %>
// display 3rd level links
<% end_if %>
(and a couple of variations of this) But it just isn't working.
Can anyone help me out?
28 June 2013 at 8:48am
What version are you on?
If SS3 i think you need to do "=="
<% if $ClassName == "CourseBase" %>
Remember ?flush=all other than that i don't know.
28 June 2013 at 9:30am
Is CourseBase the classname of the level 1 or level 2 class? If it's the level 1 class, then use <% if $Parent.ClassName = 'CourseBase' %>. If it could also be a subclass of CourseBase, then use <% if $is_a('CourseBase') %> or <% if $Parent.is_a('CourseBase') %>.
You can also put in $ClassName/$Parent.ClassName outside of the if to make sure it's what you expect. Remember, with the equality check, case matters.
Both one and two equal signs are fine, and you only need to flush when adding new templates.
28 June 2013 at 9:12pm
I've managed to fix it. I was checking for the wrong thing as I was a little confused by the way lemonstand's templating works, but I'm now checking for the correct class name, and it's working as intended
28 June 2013 at 10:34pm
Thank you simon_w, i just thought you needed to have duoble == sign in ss3, i guess it is recommended, but not a must.
When changing included templates, i very often have to flush to see changes.
|Go to Top|