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.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

DataObjectManager : <% sprintf(....) %> displayed on the website


48 Posts   8464 Views

Vegas Rob

30 April 2010 at 10:32am Community Member, 5 Posts

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.


18 August 2010 at 1:46am Community Member, 19 Posts

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?


18 August 2010 at 3:52am 4085 Posts

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

18 August 2010 at 4:01am Community Member, 109 Posts

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.


4 October 2010 at 11:53pm Community Member, 5 Posts


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.



5 October 2010 at 4:11am Community Member, 5 Posts

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


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


7 October 2010 at 8:31am Community Member, 4 Posts

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

Thank you very much.


15 October 2010 at 2:59am Community Member, 178 Posts

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.