Permalink
Browse files

fix #18392 - new option Translation2[CommonPageID] - if set all templ…

…ates share the same page id.

git-svn-id: http://svn.php.net/repository/pear/packages/HTML_Template_Flexy/trunk@310195 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 1e3f3dd commit 20e53bd14e271438facb53e92c6839a1a0ce794d @roojs roojs committed Apr 13, 2011
Showing with 18 additions and 8 deletions.
  1. +4 −0 HTML/Template/Flexy.php
  2. +14 −8 HTML/Template/Flexy/Compiler/Flexy.php
View
@@ -150,8 +150,12 @@ class HTML_Template_Flexy
// set to:
// 'Translation2' => array(
// 'driver' => 'dataobjectsimple',
+ // 'CommonPageID' => true
// 'options' => array()
// );
+ //
+ // Note: CommonPageID : to use a single page id for all templates
+ //
// or the slower way..
// = as it requires loading the code..
//
@@ -245,15 +245,21 @@ function initializeTranslator() {
if (is_a($this->options['Translation2'], 'Translation2')) {
$this->options['Translation2']->setLang($this->options['locale']);
- // fixme - needs to be more specific to which template to use..
- foreach ($this->options['templateDir'] as $tt) {
- $n = basename($this->currentTemplate);
- if (substr($this->currentTemplate, 0, strlen($tt)) == $tt) {
- $n = substr($this->currentTemplate, strlen($tt)+1);
- }
- //echo $n;
+
+ if(empty($this->options['Translation2']['CommonPageID'])) {
+ // fixme - needs to be more specific to which template to use..
+ foreach ($this->options['templateDir'] as $tt) {
+ $n = basename($this->currentTemplate);
+ if (substr($this->currentTemplate, 0, strlen($tt)) == $tt) {
+ $n = substr($this->currentTemplate, strlen($tt)+1);
+ }
+ //echo $n;
+ }
+ $this->options['Translation2']->setPageID($n);
+ } else {
+ $this->options['Translation2']->setPageID($this->options['Translation2']['CommonPageID']);
}
- $this->options['Translation2']->setPageID($n);
+
} elseif (defined('LC_ALL')) {
// not sure what we should really use here... - used to be LC_MESSAGES.. but that did not make sense...
setlocale(LC_ALL, $this->options['locale']);

0 comments on commit 20e53bd

Please sign in to comment.