Esempio n. 1
0
 /**
  * Insert an image.
  * @param $file Path to file (can be an asset or an absolute path).
  * @param string[] $attributes Attributes, see {@see Html::readAttributes}.
  * @return string HTML image.
  */
 public function img($file, $attributes = array())
 {
     $img = $this->create('img');
     $img->attr('alt', $file);
     $img->attr($attributes);
     if (!Utilities::isAbsolutePath($file)) {
         $file = $this->view->file($file);
     }
     $img->attr('src', $file);
     return $img->toString();
 }
Esempio n. 2
0
File: View.php Progetto: jivoo/jivoo
 /**
  * Find layout template for a template.
  * @param string $template Template name.
  * @return string|null Name of layout template or null if not found.
  */
 public function findLayout($template)
 {
     if (Utilities::isAbsolutePath($template)) {
         return null;
     }
     $extension = Utilities::getFileExtension($template);
     $dir = $template;
     do {
         $dir = dirname($dir);
         if ($dir === '.') {
             $template = 'layout.' . $extension;
         } else {
             $template = $dir . '/layout.' . $extension;
         }
         $file = $this->findTemplate($template);
         if (isset($file)) {
             return $template;
         }
     } while ($dir != '.');
     return null;
 }