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

<% if Link == "/" %> not work


Go to End


12 Posts   2834 Views

Avatar
Josua

Community Member, 87 Posts

9 March 2012 at 1:08am

Hi Barry!

I could not use a function in the page controller because the Link is in a control block ( <% control Menu(1) %>), unless of course that I pass the link through a parameter to this function.

Of all the ways, Junitou's solution has worked for me.

Thanks!

Regards,
Jose

Avatar
swaiba

Forum Moderator, 1899 Posts

9 March 2012 at 1:11am

Hey Josua,

I'm always happy when somone gets a solution with or without my advice :)

The reason I sugest a function is to make the template more readable and it is easier to debug. And I disagree anything you can do it a template
you can do in a function and call that instead.

Barry

Avatar
Juanitou

Community Member, 323 Posts

9 March 2012 at 2:42am

Hi Josua,

IMHO, you should follow Barry advice. By the way, it would be more interesting as you would better understand the inner workings of SilverStripe.

Best whishes,
Juan

Avatar
Josua

Community Member, 87 Posts

9 March 2012 at 3:33am

I am happy to have teachers like you.
You are awesome.
I will follow all your advices. :)

Thanks,

Regards,
Jose

Go to Top