ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 8543


Ignore:
Timestamp:
Oct 1, 2008, 8:19:40 PM (12 years ago)
Author:
ebihara
Message:

#2039:view.yml の設定によってテンプレート拡張をおこなうよう変更

Location:
OpenPNE3/trunk
Files:
5 added
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/lib/helper/PartsHelper.php

    r8045 r8543  
    5252{
    5353  $context = sfContext::getInstance();
     54  $lastActionStack = $context->getActionStack()->getLastEntry();
     55  $lastAction = $lastActionStack->getModuleName().'/'.$lastActionStack->getActionName();
     56
     57  $viewInstance = sfContext::getInstance()->get('view_instance');
     58  $customizes = $viewInstance->getCustomize('', $id, $lastAction, $name);
     59
    5460  $content = '';
    55   $extension = '.php';
    56 
    57   $moduleName = $context->getActionStack()->getLastEntry()->getModuleName();
    58   $templateName = '_' . $id . $name . $extension;
    59   $directories = $context->getConfiguration()->getTemplateDirs($moduleName);
    60 
    61   foreach ($directories as $directory) {
    62     $templatePath = $directory . DIRECTORY_SEPARATOR . $templateName;
    63 
    64     if (_is_disabled_plugin_dir($directory)) {
     61  foreach ($customizes as $customize) {
     62    $moduleName = $customize[0];
     63    $actionName = '_'.$customize[1];
     64    $view = new sfPartialView($context, $moduleName, $actionName, '');
     65    if (_is_disabled_plugin_dir($view->getDirectory())) {
    6566      continue;
    6667    }
    67 
    68     if (is_readable($templatePath)) {
    69       ob_start();
    70       ob_implicit_flush(0);
    71       require $templatePath;
    72       $content .= ob_get_clean();
    73     }
     68    $content .= $view->render();
    7469  }
    7570
    76   slot($id . $name);
    7771  echo $content;
    78   end_slot();
    7972}
    8073
Note: See TracChangeset for help on using the changeset viewer.