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.

Themes

Discuss SilverStripe Themes.

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

problem with template outputting hyper link


Reply

3 Posts   988 Views

Avatar
kuenkuen82

9 April 2010 at 4:03pm Community Member, 41 Posts

I have a page object that has a field which contains a hyperlink, which is similar to 'http://www.website.com/publication.file.pdf'

This can be seen file inside the backend, but in the frontend it doesn't show up $hyperlink, I've also try $hyperlink.XML

Avatar
Willr

11 April 2010 at 12:28pm Forum Moderator, 5511 Posts

Could you publish your code just to make sure people can fully understand the issue.

If you have a HyperLink in the $db array then you should just be able use $HyperLink in the template. If you link to a file object (eg attach it to a page) then you have to use $HyperLink.Link

Avatar
kuenkuen82

12 April 2010 at 9:03pm Community Member, 41 Posts

I've try that be it doesn't work

   static $db = array(
       'Date' => 'Date',

      'ArticleTitle' => 'Text',
      'Hyperlink' => 'Text',
      'PublicationName' => 'Text',
      'Vol_Issue' => 'Text',
      'PublicationOrigin' => 'Text',
      'Language' => 'Text',
      'ArticleType' => 'Text',
      'ProjectAward' => 'Text',
      'RelatedOffice' => 'Text',
      'ProjectCity' => 'Text',
      'Person' => 'Text',
      'ClientPerson' => 'Text',
      'ThirdParty' => 'Text',
      'ExternalHyperlink' => 'Varchar(255)',
      'Filename' => 'Varchar(255)',
   );

<strong><a class="tooltip" href="$ExternalHyperlink" rel="#note_$ID">$Title.XML</a></strong>

As you can see I have two links, the Hyperlink works fine, but when I use ExternalHyperlink nothing is output. All the other fields work fine too