Jump to:

23459 Posts in 18906 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Passing parameters into template.ss

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

Page: 1
Go to End
Author Topic: 1443 Views
  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Passing parameters into template.ss Link to this post

    Is it possible to write into .ss file $Price_Product($ProductID)?

    I've syntax error.

    I create a workaround with a function that don't want parameters:

    function Price_Product_2() {
    $prod=DataObject::get_by_id('Product', $this->Product()->ID);
    return $prod->PriceProduct;
    }

    Thank you

  • biapar
    Avatar
    Forum Moderator
    435 Posts
  • ttyl
    Avatar
    Community Member
    114 Posts

    Re: Passing parameters into template.ss Link to this post

    I don't think that is possible. I figured out some ways to do it before, but the implementation was weird - you couldn't pass in more than one argument or an argument with spaces. I was able to find work-around in my controller for what I was doing.

  • swaiba
    Avatar
    Forum Moderator
    1788 Posts

    Re: Passing parameters into template.ss Link to this post

    You can pass an argument into a $FunctionCall as long as it is hardcoded, e.g. $FunctionCall(5) but not using a $iVariable that has the value 5. Something about only having one pass of the template...

  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: Passing parameters into template.ss Link to this post

    I suppose...

    1443 Views
Page: 1
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.