Jump to:

23493 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » [solved] force file download

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 2
Go to End
Author Topic: 2709 Views
  • zenmonkey
    Community Member
    528 Posts

    Re: [solved] force file download Link to this post

    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

  • ekersten
    Community Member
    16 Posts

    Re: [solved] force file download Link to this post

    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

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