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.

General Questions /

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

Usability issue inserting links


Reply


4 Posts   741 Views

Avatar
MarijnKampf

Community Member, 164 Posts

3 March 2010 at 2:30am

This is not a real question or bug but more a usability issue I came across that I would like to see considered.

I've used Xenu link checker on a site, after one of my clients has used the SilverStripe CMS system for a couple of months. I've noticed that for external links they often forget the http:// bits. Trying this myself I have noticed the following happening when creating an external link:

1. I select Link to 'Another website'.
2. I paste the URL, but forget adding 'http://', starting with www only as my client does.
3. Inserting the link Silverstripe reverts the link to 'Page on the site' rather than 'Another website'

Wouldn't it make more sense if SilverStripe automatically adds http:// if 'Another website' is selected rather than revert to 'Page on the site'?

Avatar
Mo

Community Member, 510 Posts

3 March 2010 at 5:42am

This would make a lot of sense, either that or validator checks to ensure http:// is present if someone adds an external link.

Mo

Avatar
carlos

Community Member, 41 Posts

3 March 2010 at 5:00pm

Hi,

It's been fixed in 2.4

cheers

Avatar
Ben_W

Community Member, 80 Posts

3 March 2010 at 8:26pm

this can be archived by adding the following function into your page type class.

public function onBeforeWrite() {
      parent::onBeforeWrite();
      
      $url = $this->ShoppingCartButtonLink;
      
      if($url) {
         if(substr($url, 0, 8) != 'https://') {
            if(substr($url, 0, 7) != 'http://') {
               $url = $this->ShoppingCartButtonLink = 'http://' . $url;
            }
         }
      }
      
      $this->ShoppingCartButtonLink = $url;
   }

The 'ShoppingCartButtonLink' is one of the external link I added in one of my page.