Jump to:

3431 Posts in 1025 Topics by 864 members

Template Questions

SilverStripe Forums » Template Questions » Permalinks - Modifying Url's

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

Page: 1
Go to End
Author Topic: 1041 Views
  • edenview
    Avatar
    Community Member
    13 Posts

    Permalinks - Modifying Url's Link to this post

    Hi there,

    I am trying to change each page to point to a permanent link.

    For example:

    Clicking on Sport link takes me to www.edenviewphotography.com.au/Sport/

    I would like it to take me to www.edenview photography.com.au/Sport/#num=content-309&id=album-8

    This way people only have to download x1 file instead of multiple swf files.

    If you know how I can modify the links please let me know.

  • joshy
    Avatar
    Community Member
    57 Posts

    Re: Permalinks - Modifying Url's Link to this post

    How is that link generated?

    You'll could add a db field for 'RealLink':

    class MyPage extends Page {
    static $db = array('RealLink' => 'Varchar(255)');
    }

    ...and then override Link() to go append it:

    class MyPage extends Page {
    static $db = array('RealLink' => 'Varchar(255)');
    function Link()
    {
    return $this->Link.'/'.$this->RealLink;
    }
    }

    In the template you could then just continue using $Link to output it.

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