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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Passing parameters into template.ss


Go to End


5 Posts   1821 Views

Avatar
biapar

Forum Moderator, 435 Posts

3 July 2010 at 7:33pm

Edited: 07/07/2010 8:09pm

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

Avatar
biapar

Forum Moderator, 435 Posts

8 July 2010 at 1:07am

?

Avatar
ttyl

Community Member, 114 Posts

9 July 2010 at 3:00am

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.

Avatar
swaiba

Forum Moderator, 1899 Posts

9 July 2010 at 3:20am

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...

Avatar
biapar

Forum Moderator, 435 Posts

16 July 2010 at 11:20pm

I suppose...