Jump to:

23493 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Static Publisher on Windows

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: 234 Views
  • ekersten
    Avatar
    Community Member
    16 Posts

    Static Publisher on Windows Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Static Publisher on Windows Link to this post

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

  • ekersten
    Avatar
    Community Member
    16 Posts

    Re: Static Publisher on Windows Link to this post

    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

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