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.

Template Questions /

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

Permalinks - Modifying Url's


Go to End


2 Posts   2102 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.