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

Static Publisher on Windows


Reply


3 Posts   264 Views

Avatar
ekersten

Community Member, 16 Posts

10 August 2013 at 2:15pm

Hi guys, I was having a little problem implementing Static Publisher my local Windows machine. The error was a notice that BASE_URL was not being defined and so the static-main.php script jumped to main.php.

My solution was to replace line 45 of static-main.php with this:

$urlSegmentToRemove = str_replace('\\', '/', str_replace('\\\\', '\\', substr($path, strlen(BASE_PATH))));

I don't know if it's the cleaner way to do it but I got it to work that way and doesn't seem to mess anything on a Linux env.

If you have any comments to improve this, they're welcome. Otherwise I hope this can help someone having the same issues.

Avatar
Willr

Forum Moderator, 5513 Posts

11 August 2013 at 5:53pm

Thanks, have you submitted the fix via Github for review? No need to clone / fork you could edit the file by hand through the GUI.

The only way to make it cleaner would be to use DIRECTORY_SEPARATOR so that we handle both / and \ (which I assume was your fix?)

Avatar
ekersten

Community Member, 16 Posts

12 August 2013 at 2:41am

Willr, I didn't use DIRECTORY_SEPARATOR on purpouse as to force the path to be normalized using foward slash, since it also works on windows most of the times or at least in this case.

I'll submit it for review.

Thanks