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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Template Questions /

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

Permalinks - Modifying Url's


Go to End


2 Posts   1636 Views

Avatar
edenview

Community Member, 13 Posts

29 May 2010 at 7:10am

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.

Avatar
joshy

Community Member, 57 Posts

29 May 2010 at 11:48am

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.