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.

Archive /

Our old forums are still available as a read-only archive.

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

Passing DB Field to Function


Go to End


2 Posts   3778 Views

Avatar
Garrett

Community Member, 245 Posts

25 October 2008 at 8:10am

Hi,

In my template, I am passing the value of a CMS-entered db field, a URL, to a function in my page class like so:

$LastRSSFeedAuthor($StaffRSSFeedURL)

...and am getting the following error:

Parse error: syntax error, unexpected T_STRING, expecting ')' in C:\WINDOWS\Temp\silverstripe-cacheC--wwwroot-wamp-www-horngroup\.cacheC..wwwroot.wamp.www.horngroup.mysite.templates.Layout.StaffHolder.ss on line 117

This function takes a URL as a parameter, and is working fine elsewhere as long as the actual URL is passed. If it is a VARIABLE, it chokes up on me. What am I doing wrong here?

In other words, it works like this:

$LastRSSFeedAuthor(http://horngroup.blogs.com/horn_group_weblog/rss-sabrinahorn.xml)

What's the difference???

Thanks,
Garrett

Avatar
Willr

Forum Moderator, 5523 Posts

25 October 2008 at 12:50pm

You can't pass variables to functions in the template eg they can't be $Vars. Its one of the short comings of the template parser. You will
need to find a way around this somehow :)