Ejemplo n.º 1
0
 /**
  * Singleton instance
  *
  * @param array $config
  * @return Url
  */
 public static function getInstance($config = array())
 {
     if (null === self::$_instance) {
         self::$_instance = new self($config);
     }
     return self::$_instance;
 }
Ejemplo n.º 2
0
 /**
  * @param $translation array Translate the raw categories and page name into a more expressive name.
  * @return string
  */
 public function MakeBreadcrumb()
 {
     $url = Taplod_Url::getInstance();
     $breadcrumb = array_merge($url->getCurrentCategories(), array($url->getCurrentPage()));
     $attribs = array('ul' => array('class' => 'breadcrumb'), 'li' => array(0 => array('class' => 'first')));
     return parent::MakeList(self::translate($breadcrumb), $attribs);
 }
Ejemplo n.º 3
0
 public function PartialContent($partial, $page, $data = null)
 {
     if ($partial != null && $page != null) {
         self::init($partial, $page);
     }
     if (is_null($data)) {
         return $this;
     }
     $template = $this->cloneTemplates();
     $template->clearVars();
     $url = Taplod_Url::getInstance();
     $template->loadPartialFile('partial-' . $this->partialName, $this->page . '-' . $this->partialName . '.tpl.phtml');
     if (is_array($data)) {
         $template->assign($data);
     } else {
         $template->assign('partialVars', $data);
     }
     return $template->render('partial-' . $this->partialName);
 }
Ejemplo n.º 4
0
 public function url($page, $arguments = false, $category = false)
 {
     $url = Taplod_Url::getInstance();
     return $url->buildUri($page, $arguments, $category);
 }
Ejemplo n.º 5
0
<?php

/**
 * @category Ayaq
 * @copyright Copyright (c) 2009, Bellière Ludovic
 * @license http://opensource.org/licenses/mit-license.php MIT license
 */
defined('APPLICATION_PATH') or define('APPLICATION_PATH', dirname(__FILE__));
defined('APPLICATION_ENVIRONMENT') or define('APPLICATION_ENVIRONMENT', 'development');
defined('TEMPLATE_PATH') or define('TEMPLATE_PATH', realpath(dirname(__FILE__) . '/../templates') . '/');
if (!isset($_SESSION['quizz_step'])) {
    // quizz_step = 0 -> n-1
    $_SESSION['quizz_step'] = 0;
}
mb_internal_encoding("UTF-8");
$db = Taplod_Db::factory('Pdo_Mysql', $config->db);
$db->exec("SET character_set_results='utf8'");
require_once 'Taplod/Url.php';
$url = Taplod_Url::getInstance($config->url);
Taplod_ObjectCache::set('URL', $url);
$tpl = new Taplod_Templates();
if ($category = $url->getCategoryPath()) {
    if (file_exists($category . 'bootstrap.php')) {
        require $category . 'bootstrap.php';
    }
    unset($category);
}
require $url->getPagePath() . '.php';