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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

sprintf() error on eCommerce


Go to End


3 Posts   2379 Views

Avatar
Josh

SilverStripe Developer, 65 Posts

22 April 2008 at 9:04am

Hello,

One step closer to getting the 0.5.2 rc1 eCommerce up and running - but i've hit a brick wall with this XML Parsing error.

http://www.affordablefantasy.co.nz/products/

I have been told to enable i18n, which I have done - set the locale to en_US, db/build?flush=1 and the error still appears. I'm lost!

Cheers

Avatar
cmswarrior

Community Member, 13 Posts

28 April 2008 at 2:36pm

Am not sure if you have found the answer to your question, but just in case you haven't and for anyone else out there, try this:

navigate to \sapphire\core\SSViewer.php, locate the following lines:

// i18n
ereg('.*[\/](.*)',$template,$path);
$content = ereg_replace('<' . '% +_t\((\'([^\']*)\'|"([^"]*)")(([^)]|\)[^ ]|\) +[^% ])*)\) +%' . '>', '<?= _t(\''. $path[1] . '.\\2\\3\'\\4) ?>', $content);

right below that look for:

// i18n - sprintf => "sprintf(_t(...),$argument)"
// CAUTION: No spaces allowed between arguments!
$content = ereg_replace('<' . '% +sprintf\(_t\((\'([^\']*)\'|"([^"]*)")(([^)]|\)[^ ]|\) +[^% ])*)\),\<\?= +([^\?]*) +\?\>) +%' . '>', '<?= sprintf(_t(\''. $path[1] . '.\\2\\3\'\\4),\\6) ?>', $content);

if you don't find it, then include it (make sure you place it right below).

OR just use the lastest version of SSviewer.php in trunk.

Hope this helps somebody out there.

Avatar
Josh

SilverStripe Developer, 65 Posts

28 April 2008 at 3:04pm

Edited: 28/04/2008 3:36pm

Thank you.

I think it worked!