Jump to:

23456 Posts in 18905 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Link to local page - impossible?

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: 828 Views
  • Anteaus
    Community Member
    3 Posts

    Link to local page - impossible? Link to this post

    As I'm incorporating SS into an existing large site I need to link to local static pages on the same server/domain.

    I didn't envisage any probs until I tried to setup the links as redirect pages, when I discovered that the redirect page form wrongly but automatically adds 'http://' to local links, rendering them broken.

    But, if I use FQDN links this will make it impossible to test the site before uploading. Plus, it is bad website practice to do so.

    The webpage editor has the same problem too, making it impossible to link to any local file. I can hack-around this one by entering HTML directly, but no such workaround exists for menu redirector pages

    Is there any way of resolving this, other than hacking the cms code?

    v2.4.7 on xampp test site.


    Since no comments, I Might add that this seems to be a classic example of 'duck programming' -Exactly what the coders say a cms shouldn't contain. Namely, creating a system with 'ease of use' features which straitjacket the user into nonstandard ways of working. It's also painfully evident that this feature wasn't tested properly, or the negative consequences would have been spotted.

    Mind you it is by no means the only example. Perhaps the most serious is that standard php code cannot be used in templates.

    OK, flame me if you wish, but I think it is unwise to soapbox about duck code when features like this abound.

  • Willr
    Forum Moderator
    5497 Posts

    Re: Link to local page - impossible? Link to this post

    It's likely that testing pointing to a local html file on the same domain has not be a use case thats come up (most people have all their content in SilverStripe or the 2 separate).

    The code that adds the http is in Redirector page (https://github.com/silverstripe/silverstripe-cms/blob/master/code/model/RedirectorPage.php#L111). So it makes it quite clear that relative file paths were never thought of.

    I recommend submitting a patch to add a new type called 'Relative' perhaps (https://github.com/silverstripe/silverstripe-cms/blob/master/code/model/RedirectorPage.php#L14). You would just need to update a couple functions to say if Relative or External return the URL Field (i.e https://github.com/silverstripe/silverstripe-cms/blob/master/code/model/RedirectorPage.php#L68)

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.