Example #1
0
File: Web.php Project: atk4/atk4
 /**
  * Called on all templates in the system, populates some system-wide tags.
  *
  * @param Template $t
  */
 public function setTags($t)
 {
     // Determine Location to atk_public
     if ($this->app->pathfinder && $this->app->pathfinder->atk_public) {
         $q = $this->app->pathfinder->atk_public->getURL();
     } else {
         $q = 'http://www.agiletoolkit.org/';
     }
     $t->trySet('atk_path', $q . '/');
     $t->trySet('base_path', $q = $this->app->pm->base_path);
     // We are using new capability of SMlite to process tags individually
     try {
         $t->eachTag($tag = 'template', array($this, '_locateTemplate'));
         $t->eachTag($tag = 'public', array($this, '_locatePublic'));
         $t->eachTag($tag = 'js', array($this, '_locateJS'));
         $t->eachTag($tag = 'css', array($this, '_locateCSS'));
         $t->eachTag($tag = 'page', array($this, '_locatePage'));
     } catch (BaseException $e) {
         throw $e->addMoreInfo('processing_tag', $tag)->addMoreInfo('template', $t->template_file);
     }
     $this->hook('set-tags', array($t));
 }