Jump to:

3393 Posts in 976 Topics by 852 members

Template Questions

SilverStripe Forums » Template Questions » <% if Link == "/" %> not work

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

Page: 1 2
Go to End
Author Topic: 919 Views
  • Josua
    Avatar
    Community Member
    86 Posts

    Re: <% if Link == "/" %> not work Link to this post

    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

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: <% if Link == "/" %> not work Link to this post

    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

  • Juanitou
    Avatar
    Community Member
    322 Posts

    Re: <% if Link == "/" %> not work Link to this post

    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

  • Josua
    Avatar
    Community Member
    86 Posts

    Re: <% if Link == "/" %> not work Link to this post

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

    Thanks,

    Regards,
    Jose

    919 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.