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


Reply


48 Posts   8781 Views

Avatar
JoshuaLewis

Community Member, 76 Posts

7 March 2010 at 11:35pm

I thought I would post this here since it's the only thread I've found about <% sprintf(...) %>. Hopefully the info will be helpful to someone that knows more than I do.

<% sprintf(...) %> has been showing up in my CMS admin since last week when I updated my copy of XAMPP from 1.7.1 to 1.7.3. For me at least the problem seems to be connected with what versions of server software are running since I can install Silverstripe on clean installs of XAMPP 1.7.1 and WAMPServer 2.0i and have everything show up correctly. (XAMPP 1.7.3 runs Apache2.2.14, PHP5.3.1, and mySQL5.1.41 while v1.7.1 and WAMPServer both run slightly older versions of each.)

WAMPServer is supposed to support easy install of and swapping between different versions of Apache, PHP, MYSQL. I tried to test my theory and replicate the problem by using that feature but for some reason WAMPServer keeps hanging up on something when it restarts after switching to PHP 5.3.1

Also the sprintf strings show up in installs of different versions of SS but the correct text gets rendered on the pair of remote servers I have ss installed on.

Avatar
UncleCheese

Forum Moderator, 4096 Posts

8 March 2010 at 3:48am

Thanks.. yeah, it's a weird bug. I think ultimately I may just have to move the translation to the controller and get all that syntax off the template.

Avatar
JoshuaLewis

Community Member, 76 Posts

8 March 2010 at 12:02pm

Edited: 08/03/2010 12:18pm

That might need to be done but I should have added earlier that this bug isn't restricted to DOM and is showing up for me in ModelAdmin tabs, Security Group permission tabs, and other places. If this thread hadn't already been here I'd have posted in General Discussion.

I think that sometime this next week I'll post a bug report but first I want to try and figure out a way of testing and narrowing down what's going on.

Avatar
Terry Apodaca

Community Member, 109 Posts

9 March 2010 at 5:38am

Have had the same issue, no real fix for it other than removing the sprintf()...on your local machines. Works fine in most other 'real' linux installations...just not on XAMPP or other windows installations...

If there is a fix soon...sure would be nice.

Avatar
UncleCheese

Forum Moderator, 4096 Posts

9 March 2010 at 5:56am

It's really bizarre that this is a server level issue. Does it happen anywhere else in Silverstripe?

Avatar
Terry Apodaca

Community Member, 109 Posts

9 March 2010 at 6:18am

Edited: 09/03/2010 6:18am

I've seen it in ModelAdmin templates as well.

When you first log into the CMS, the welcome message shows just fine...but if you click on a ModelAdmin then the welcome screen shows it...I'll post a few screenshots.

the DOM does it on the Button and if no records are there...you'll see in the screenshots.

here is the thread i started so that i could get the screenshots posted: http://www.silverstripe.org/general-questions/show/280474?showPost=280474

Avatar
MateuszU

Community Member, 89 Posts

9 March 2010 at 10:24am

Edited: 09/03/2010 10:25am

Hi,
I have been trying to track this one down, for me SSViewer seems to support this syntax for the templates:

<% sprintf(_t('WELCOME1','Welcome to %s. Please choose on one of the entries in the left pane.'),$ApplicationName) %>

but not this

<% sprintf(_t('WELCOME1','Welcome to %s. Please choose on one of the entries in the left pane.'),some value) %>

Some time ago everything in the core templates has been changed into the former syntax. If any of you can understand the following voodoo SSViewer snippet, then it's probably somewhere inside :)

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

Avatar
timwjohn

Community Member, 98 Posts

7 April 2010 at 8:30am

I'm having the same issue in ModelAdmin with DOM, but not anywhere else like some others are. I too am only seeing this issue since upgrading to XAMPP 1.7.3.

At the moment I'm just gonna remove the sprintf() instances, but am eager to know if anyone gets this sorted. That regular expression mateuzs posted looks painful!