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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

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

Desesperate for <%if param == url %>


Go to End


3 Posts   1597 Views

Avatar
santosmateo

Community Member, 14 Posts

10 September 2011 at 5:13am

Edited: 10/09/2011 5:16am

I have a couple of days trying the following:

1. I have a menu with a list of items from a table (table1).

2. I have a few pages with calls to the same elements of the table from $ MANY_MANY relationship

I access the url through getURLParams () from a function in the parent page:

         public function get_url_action() {
            $full_url = $this->getURLParams();
            $url_action= $Params[Action]; 
            return new ArrayData(array("url" => $url_action));
     }

I call it with

<% control get_url_action%>
$ url
<% end_control%>

can be:
<% Control Children%>
<% Control table1%>
<% If value_table1 == get_url_action%>
I can see the data from the Children page
<% end_if%>
<% end_control%>
<% end_control%>

thank you very much, I'm a little lost.

Avatar
Ryan M.

Community Member, 309 Posts

10 September 2011 at 6:21am

This is a pretty good tutorial on how to use the Page Controller and urlParams to serve up customized content.

http://www.ssbits.com/tutorials/2010/dataobjects-as-pages-part-1-keeping-it-simple/

Avatar
santosmateo

Community Member, 14 Posts

24 September 2011 at 1:59am

Ryan, sorry for the delay to respond, but was a little busy these days.

Thank you very much for the information, I was studying it and maybe I can integrate it into my web.

Again thank you very much!