Jump to:

22976 Posts in 11702 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Usability issue inserting links

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

Page: 1
Go to End
Author Topic: 665 Views
  • MarijnKampf
    Avatar
    Community Member
    161 Posts

    Usability issue inserting links Link to this post

    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'?

  • Mo
    Avatar
    Community Member
    485 Posts

    Re: Usability issue inserting links Link to this post

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

    Mo

  • carlos
    Avatar
    Community Member
    41 Posts

    Re: Usability issue inserting links Link to this post

    Hi,

    It's been fixed in 2.4

    cheers

  • Ben_W
    Avatar
    Community Member
    79 Posts

    Re: Usability issue inserting links Link to this post

    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.

    665 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.