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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Link to local page - impossible?


Go to End


2 Posts   1587 Views

Avatar
Anteaus

Community Member, 3 Posts

16 May 2012 at 10:16pm

Edited: 17/05/2012 11:01pm

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.

Avatar
Willr

Forum Moderator, 5523 Posts

20 May 2012 at 12:11pm

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)