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   833 Views

Avatar
Paco728

Community Member, 28 Posts

7 August 2011 at 8:41pm

Edited: 07/08/2011 8:49pm

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

Forum Moderator, 474 Posts

7 August 2011 at 9:43pm

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

Community Member, 28 Posts

8 August 2011 at 10:58am

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

Community Member, 28 Posts

8 August 2011 at 1:53pm

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