Skip to content

Instantly share code, notes, and snippets.

@betaman
Last active December 11, 2015 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save betaman/4627374 to your computer and use it in GitHub Desktop.
Save betaman/4627374 to your computer and use it in GitHub Desktop.
i18n Problem
<!-- bootstrap.php -->
<?php
// set the language homepage for dynamic navigation
define ('HOMEPAGE', 'index-' . $i18n->language);
// redirect if they request the default homepage
if ($_SERVER['REQUEST_URI'] === '/' || $_SERVER['REQUEST_URI'] === '/index') {
$controller->redirect ('/' . HOMEPAGE);
}
?>
<!-- layouts/default.html about line 24 -->
<div class="grid_6 omega menu">
{! navigation/section?section=[constant('HOMEPAGE')] !}
</div>
<!-- cache/default.php -->
<div class="grid_6 omega menu">
<?php echo $this->controller->run ('navigation/section', array ('section' => Template::sanitize (constant(\'HOMEPAGE\'), 'UTF-8'))); ?>
</div>
@betaman
Copy link
Author

betaman commented Jan 24, 2013

About this Problem again: http://www.elefantcms.com/forum/discussion/comment/1074#Comment_1074

Can you please try out, if this happens to you when doing a clean Install from the Master and go step by Step through this guide: http://www.elefantcms.com/wiki/Multilingual-website-setup

I know you tested it already, but it might have to do that I define the HOMEPAGE CONST in bootstrap.php

@jbroadway
Copy link

Very strange, just did a fresh install from master, added the exact same bootstrap.php, created a few index-lang pages, and changed the {! navigation/top !} to {! navigation/section?section=[constant('HOMEPAGE')] !} in layouts/default.html and I'm not having the backslashed single quotes issue.

My guess is there must be something in lib/Template.php either in replace_includes() or replace_vars() that adds the backslashes or not depending on a PHP setting... Can you send me your phpinfo output? I'll try to match your settings here to see if that uncovers it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment