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

[solved] force file download


Go to End


10 Posts   6789 Views

Avatar
zenmonkey

Community Member, 545 Posts

30 September 2011 at 3:07am

Okay I think I'm starting to understand what you're trying to do. The way you have it structured you're passing download as a variable to the link method. What you want to do is create a urls that calls the page/action/id method. So it should be

<a href="{$Top.Link}/download/{$SongFile.ID}" title="$Title.XML">Download</a> 

so the url is structured: url of page / method you want to call / id you want to pass

Hope that helps

Avatar
ekersten

Community Member, 16 Posts

30 September 2011 at 3:18am

Edited: 30/09/2011 3:22am

Sorry for the confusion, but the code i posted is actualy working.

$Link is a method in the SiteTree model and it takes an $action optional parameter, hence the $Top.Link(download).

Here's a link to the API documentation http://api.silverstripe.org/2.4/cms/SiteTree.html#methodLink

Go to Top