mstdmstd
Новичок
Всем привет
В Kohana 3.3.0 делаю свой модуль для подключения Smarty.
Ранее у меня был отдельный обьект который лежал в classes, к нему было обращение:
	
	
	
		
И все работало нормально.
Переделываю в модуль :
В bootstrap.php прописал :
	
	
	
		
В /modules/appsmarty/classes/Kohana/Appsmarty.php :
	
	
	
		
Вызов модуля:
	
	
	
		
И проблема как раз и начинается при первом вызове плагина  show_sorting_directory я получаю ошибку :
	
	
	
		
В темплейте :
	
	
	
		
Причем если закоментарить вызовы всех плагинов - то страница отображается нормально.
Плагины не найдены ? А как правильно?
								В Kohana 3.3.0 делаю свой модуль для подключения Smarty.
Ранее у меня был отдельный обьект который лежал в classes, к нему было обращение:
		PHP:
	
				$AppSmarty= new AppSmarty();
			$data = $AppSmarty->AddSystemParameters( $some_data , null, '', true);
			$AppSmarty->PrepareSmartyTemplate( $kohana_view_filename, $data, '', true, true, true);
			$AppSmarty->display($kohana_view_filename, $data);
	Переделываю в модуль :
В bootstrap.php прописал :
		PHP:
	
		 'appsmarty' => MODPATH.'appsmarty',
	
		PHP:
	
	<?php defined('SYSPATH') or die('No direct script access.'); // как обычно - защита от прямого доступа
      $app_config = Kohana::$config->load('app');
      if ( !defined("SMARTY_DIR" ) ) {
        define("SMARTY_DIR", $app_config['smarty_dir']);
      }
      echo '<pre> SMARTY_DIR ::'.print_r( SMARTY_DIR, true ).'</pre><br>';
      require_once(SMARTY_DIR . 'Smarty.class.php'); // Подключаю смарти и вывожу на экпан пути - все ok
class Kohana_Appsmarty  extends Smarty {
 
    public static function instance(array $config = array())
    {
      return new Appsmarty($config);
    }
 
    public function __construct(array $config = array())
    {
		parent::__construct();
    }    
    
	public function PrepareSmartyTemplate($template_name, $data, $is_backend, $show_header_template = false, $show_footer_template = false)
	{
		$this->template_dir = APPPATH . 'views';
		$this->compile_dir = APPPATH . 'cache/templates_c';
		$this->cache_dir = APPPATH . 'cache';
		$this->config_dir = APPPATH . 'classes/Smarty/libs';  // подключаю все пути и вывожу на экран - все ok
		echo '<pre> ++++ $this->template_dir ::'.print_r( $this->template_dir, true ).'</pre><br>';
		foreach ($data as $DataKey => $DataValue) {
			$this->assign($DataKey, $DataValue);  // Добавляю все переменные
		}
		$this->registerPlugin("function", "show_sorting_directory", "smShowSortingDirectory"); // Подключаю плагины
...
		echo '<pre> ++smShowSortingDirectory::</pre><br>';
	Вызов модуля:
		PHP:
	
				$data = Appsmarty::instance()->AddSystemParameters( $kohana_view_data , null, '', true);
			Appsmarty::instance()->PrepareSmartyTemplate( $kohana_view_filename, $data, '', true, true, true);
			Appsmarty::instance()->display($kohana_view_filename, $data);
	
		PHP:
	
	SmartyCompilerException [ 0 ]: Syntax Error in template "/mnt/diskD_Work/wwwroot/kohana/backend/views/admin/cms_items_list.tpl" on line 119 "<a href="{$base_url_admin}cmsitem/index?{$PageParametersWithoutSort}&sort=alias&sort_direction={show_sorting_directory fieldname="alias" sort_direction=$sort_direction sort=$sort}">Alias&nbsp;{show_list_sorting_image fieldname="alias" sort_direction=$sort_direction sort=$sort images_dir_full_url=$images_dir_full_url}</a>" unknown tag "show_sorting_directory" 	 		
APPPATH/classes/Smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php [ 667 ]
	
		PHP:
	
	        <th>
          <a href="{$base_url_admin}cmsitem/index?{$PageParametersWithoutSort}&sort=alias&sort_direction={show_sorting_directory fieldname="alias" sort_direction=$sort_direction sort=$sort}">Alias {show_list_sorting_image fieldname="alias" sort_direction=$sort_direction sort=$sort images_dir_full_url=$images_dir_full_url}</a>
        </th>
	Плагины не найдены ? А как правильно?
	            