3212 Posts in 847 Topics by 809 members
| Go to End | ||
| Author | Topic: | 4784 Views |
-
Re: navigation drop down control

21 September 2009 at 11:07am
That did it!
Really appreciate your help!
-
Re: navigation drop down control

14 October 2009 at 1:55am
Hello,
I am a newbie and I think that I have the same problem as all of the listed above, although there is a tiny difference.
What I am trying to do is to get a my menu to generate a drop down menu.
So I figured out that this should be done with if statement as to know whether there should be a drop down list or not.So I came up with this code:
<ul>
<% control Menu(1) %>
<li><a href="$Link" id="menu_$Title" title="$Title">$MenuTitle</a></li>
<% if Children %>
<ul>
<% control Children %>
<li><a href="$Link" title="$Title">$MenuTitle</a></li>
<% end control %>
</ul>
</li>
<% else %>
</li>
<% end_if %>
<% end_control %>
</ul>Now it shoul dbe working fine but it does not, apparently my <% if Children %> statement is not recognised and causing an error to occur.
As I have said I am totally new to OOP PHP and SilverStripe use, so I don't know if I need to create a class and an object for the Children (I am somewhat ashamed of saying it but that is the truth).I have also seen people using this: <% if LinkOrSection = section %> but I do not know whether it is related or not.
Can somebody help me please ?
-
Re: navigation drop down control

14 October 2009 at 2:47am Last edited: 14 October 2009 3:27am
Hi,
What error are you getting?
<% if Children %> should work fine, but you're doing something wrong with the html.
Instead of
<ul>
<% control Menu(1) %>
<li><a href="$Link" id="menu_$Title" title="$Title">$MenuTitle</a></li>
<% if Children %>
<ul>
<% control Children %>
<li><a href="$Link" title="$Title">$MenuTitle</a></li>
<% end control %>
</ul>
</li>
<% else %>
</li>
<% end_if %>
<% end_control %>
</ul>try
<ul>
<% control Menu(1) %>
<li>
<a href="$Link" id="menu_{$Title}" title="$Title">$MenuTitle</a>
<% if Children %>
<ul>
<% control Children %>
<li><a href="$Link" title="$Title">$MenuTitle</a></li>
<% end_control %>
</ul>
<% end_if %>
</li>
<% end_control %>
</ul>Don't forget to flush!
-
Re: navigation drop down control

14 October 2009 at 3:19am
Hi,
thanks for helping.
Although I am getting the same error as before:"Parse error: syntax error, unexpected $end in C:\WINDOWS\Temp\silverstripe-cacheC--wamp-www-onedoor2\.cacheC..wamp.www.onedoor2.themes.onedoor.templates.Home.ss on line 162"
I do not know which $end it is refering too, even the line numbers are odd.
-
Re: navigation drop down control

14 October 2009 at 3:27am
end control should be end_control that's one thing I see right now that is wrong
-
Re: navigation drop down control

14 October 2009 at 3:54am
Seems that your right and that I am unbelivably blind!
Although I tried once with you version and it did not quite work, I retried it right now and it works just fine!!
Thanks a lot!!
| 4784 Views | ||
| Go to Top |




