Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

layout and menu-structure based on value of a toplevel cms-field - help needed!!!

Go to End



Community Member, 131 Posts

27 March 2009 at 10:13am

Edited: 27/03/2009 2:17pm


I'm really breaking my head over this one:
I have a field "Layout" in all of my toplevel pages (with if(!this->parent){}).
On all children-pages I want to check what's the value of that field.

Based on that value I want to render a specific div-structure.
Next to that, the value is used to determine if the menu starts at level 1 or level 2.

So for example: if Layout = Youth, it has to render a menu on level 2 and is Layout = General, it has to render a menu on level 1.

Right now, I have the following code:

<% control Level(1) %>
  <% if Layout = General %>
    <div id=General>$MenuTitle.XML</div>
  <% else_if Layout = Youth %>
    <% control Children %>
      <div id=Youth1>$MenuTitle.XML</div><div id=Youth2></div>
    <% end_control %>
  <% else_if .........
  <% end_if %>
<% end_control %>

I thought that would be translated as: Check the data on level 1: if $layout on level 1 is General: use the general-behaviour. if $layout on level 1 is Youth, use the youth-behaviour. But apparently I'm wrong.

It works on all toplevel pages. If Layout = Youth: the toplevel-menu is replaced by a second-level menu and both div's are shown. However: after clicking on one of the second-level menuitems, everything is set back to the default layout, including the toplevel-menu.

I've tried the subsites module (that would be the best) but I can't get it working (I'm using a shared host and haven't DNS-access). That's why I'm trying this workaround. Does someone now what I'm doing wrong or what I could do better?