Jump to:

7938 Posts in 1541 Topics by 945 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » DataObjectManager : <% sprintf(....) %> displayed on the website

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3 4 5 6
Go to End
Author Topic: 8325 Views
  • Vegas Rob
    Avatar
    Community Member
    5 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    Just to add my data to the mix in case it is helpful. I also had this issue while developing locally using xamp 1.7.3, but I also had the same issues trying to use WAMP Server 2.0i (tried apache 2.2.11 default and 2.2.4).

    However it all magically works when I upload the same code to my demo OSX server. I'll report back in the production Linux box also works later.

    Very strange issue. I wouldn't really know where to start debugging this. Developing this part on the server for now.

  • cake
    Avatar
    Community Member
    19 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    Are there any news on this? I've got the same issue with XAMPP 1.7.3 and DOM. Any workarounds to get it solved?

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    No, I still don't get it. If we can pin it down to a DOM specific issue, I'm happy to trouble shoot it, but I've tried moving that tag to the front end and I still get that output. It seems like it might be an SSViewer issue?

  • Terry Apodaca
    Avatar
    Community Member
    109 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    I honestly believe this isn't your DOM issue. I ONLY see this on my Windows machine with XAMPP installed. Nothing like this happens on my Mac, not on either of my linux machines.

  • Chiasmata
    Avatar
    Community Member
    5 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    Hi

    I'm having issues with this also .... ie. <% sprintf(....) %> being displayed in various places on local xampp windows setup.
    Has anyone solved it all? Even if it's just a temporary workaround.
    Apologies if I missed any other posts about it - couldn't see any answers elsewhere on the forum.

    Cheers

  • Chiasmata
    Avatar
    Community Member
    5 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    OK, after a few hours I think I finally solved it.

    Thanks to the previous post from MateuszU which pointed me in the right direction.
    I changed the sapphire/core/SSViewer.php file from:

    // i18n sprintf(_t(...),$argument) with entity only (no dots in namespace), meaning the current template filename will be added as a namespace
    $content = ereg_replace('<' . '% +sprintf\(_t\((\'([^\.\']*)\'|"([^\."]*)")(([^)]|\)[^ ]|\) +[^% ])*)\),\<\?= +([^\?]*) +\?\>) +%' . '>', '<?= sprintf(_t(\''. $path[1] . '.\\2\\3\'\\4),\\6) ?>', $content);
    // i18n sprintf(_t(...),$argument)
    $content = ereg_replace('<' . '% +sprintf\(_t\((\'([^\']*)\'|"([^"]*)")(([^)]|\)[^ ]|\) +[^% ])*)\),\<\?= +([^\?]*) +\?\>) +%' . '>', '<?= sprintf(_t(\'\\2\\3\'\\4),\\6) ?>', $content);

    to...

    // i18n sprintf(_t(...),$argument) with entity only (no dots in namespace), meaning the current template filename will be added as a namespace
          $content = preg_replace('/<' . '% +sprintf\(_t\((\'([^\.\']*)\'|"([^\."]*)")(([^)]|\)[^ ]|\) +[^% ])*)\),\<\?= +([^\?]*) +\?\>\) +%' . '>/', '<?= sprintf(_t(\''. $path[1] . '.\\2\\3\'\\4),\\6) ?>', $content);
          // i18n sprintf(_t(...),$argument)
          $content = preg_replace('/<' . '% +sprintf\(_t\((\'([^\']*)\'|"([^"]*)")(([^)]|\)[^ ]|\) +[^% ])*)\),\<\?= +([^\?]*) +\?\>\) +%' . '>/', '<?= sprintf(_t(\'\\2\\3\'\\4),\\6) ?>', $content);

    Basically, it looks like there's a problem with the now deprecated ereg_replace function so I just changed it to a preg_replace function instead.
    I'm kind of new to Silverstripe, so not sure yet how to go about getting this included in future releases (if it fully works of course). Perhaps someone can point me in the right direction or add it themselves?
    Hopefully these deprecated ereg functions will be replaced everywhere eventually.

  • kb
    Avatar
    Community Member
    4 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    Chiasmata: I can confirm that your solution works perfectly with XAMPP 1.7.3!

    Thank you very much.

  • DsX
    Avatar
    Community Member
    178 Posts

    Re: DataObjectManager : <% sprintf(....) %> displayed on the website Link to this post

    thanks, thats working for me...
    since it only gave me trouble on my local xampp install, i put it in a condition so the 'official' code runs on the live server... just in-case ;)

    good work! That looks like it would have been a trick to track down.

    8325 Views
Page: 1 2 3 4 5 6
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.