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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Link between pages of different level


Reply

4 Posts   828 Views

Avatar
Paco728

7 August 2011 at 8:41pm (Last edited: 7 August 2011 8:49pm), Community Member, 28 Posts

Hello all.

I'm trying to link from a one page (nueva zona) and from the childrens of this (nuevo equipo) to another page (nuestras sedes). Both are on the same level. I also want to link to the same site (nuestras sedes) from its parent page (nuevo torneo).

The problem is i can't use template controls such as childrenOf(url) or page(url) because the user is going to be creating these pages dynamically.

It's a bit complicated to explain, better leave the image so that it can be better understand

Attached Files
Avatar
simon_w

7 August 2011 at 9:43pm Forum Moderator, 474 Posts

If you don't need to place them in the template, then the content editor can just add the links in the content of each page. Otherwise you could use something like a has_one to SiteTree, and then a TreeDropdownField to select the page you want to link to.

Avatar
Paco728

8 August 2011 at 10:58am Community Member, 28 Posts

i doesn't need to place then in the template I just want to add the links in the content of each page, but i can't use the content of the editor they have to be created dynamically

Avatar
Paco728

8 August 2011 at 1:53pm Community Member, 28 Posts

Solve my problem using in nuevo torneo template

<% control Children %>
<% if ClassName != NuevaZona %>
<a href="$Link">$Title</a>
<% end_if %>
<% end_control %>

in nueva zona

<% control Parent %>
<% control Children %>
<% if ClassName != NuevaZona %>
<a href="$Link">$Title</a>
<% end_if %>
<% end_control %>
<% end_control %>

and in nuevo equipo

<% control Parent %>
<% control Parent %>
<% control Children %>
<% if ClassName != NuevaZona %>
<a href="$Link">$Title</a>
<% end_if %>
<% end_control %>
<% end_control %>
<% end_control %>

I'm not sure if this is the best way but it worked