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.

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   5065 Views


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


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

Go to Top