Вы не зашли.
Главная » PHP » Smarty на примере модификации форума PunBB
#91. tipsun Off (19)
Moderator
2012.02.29 21:09
А, ок. Сделаю.
#92. tipsun Off (19)
Moderator
2012.03.01 00:12
Да что такое, только вроде начал запускаться Smarty, теперь шаблоны не выводятся.
Хотя в них нет ошибок. Без скорлупы или как там, работало. sad
Добавлено спустя   7 минут  42 секунды:

wap/viewtopic.php
Код:
span style="color: #0000BB"><?php define('PUN_ROOT', '../');require_once(PUN_ROOT . 'include/common.php');require_once(PUN_ROOT . 'include/file_upload.php');require_once(PUN_ROOT . 'lang/' . $pun_user['language'] . '/post.php');//require_once(PUN_ROOT . 'wap/header.php');//require_once('header.php');require_once(PUN_ROOT . 'include/Smarty/Smarty.class.php');$smarty = new Smarty();$dir = PUN_ROOT . 'include/template/wap/' . $pun_user['style_wap'] . '/';$smarty->template_dir = $dir . 'tpls/';$smarty->compile_dir = $dir . 'compiled/';$smarty->config_dir = $dir . 'configs/';$smarty->cache_dir = $dir . 'cache/';//$this->caching = true;$smarty->assign('punDesignDir', $dir);
wap/header.php
Код:
span style="color: #0000BB"><?php if (! defined('PUN') or ! defined('PUN_ROOT')) exit(); define('PUN_HEADER', 1);require_once(PUN_ROOT . 'include/template.php');$smarty = new Pun_Template(PUN_ROOT . 'include/template/wap/' . $pun_user['style_wap'] . '/');if ($pun_user['g_id'] < PUN_GUEST) { $result_header = $db->query('SELECT COUNT(1) FROM `' . $db->prefix . 'reports` WHERE `zapped` IS NULL') or error('Unable to fetch reports info', __FILE__, __LINE__, $db->error()); if ($db->result($result_header)) { $conditions['reports'] = true; }}require PUN_ROOT . 'include/pms/wap_header_new_messages.php';
include/template.php
Код:
span style="color: #0000BB"><?php if (! defined('PUN')) exit(); define('PUN_TEMPLATE', 1);require_once('Smarty/Smarty.class.php');class Pun_Template extends Smarty{ public function __construct($dir) { $this->template_dir = $dir . 'tpls/'; $this->compile_dir = $dir . 'compiled/'; $this->config_dir = $dir . 'configs/'; $this->cache_dir = $dir . 'cache/'; //$this->caching = true; $this->assign('punDesignDir', $dir); }}
Отредактировано tipsun (2012.03.01 00:12)
#93. tipsun Off (19)
Moderator
2012.03.01 00:12
Без прослойки работает, проверил. Ну шаблон собранный показывает.
Добавлено спустя   1 минуту  27 секунд:
Где-то я туплю, видимо.
Добавлено спустя   6 минут  48 секунд:
Пойду спать.
Отредактировано tipsun (2012.03.01 00:12)
#94. tipsun Off (19)
Moderator
2012.03.02 14:02
Итак...
С прослойкой так и не разобрался.

Показать скрытый текст
Отредактировано tipsun (2012.03.02 14:02)
#95. Gemorroj Off (107)
Administrator
2012.03.02 14:02
Pun_Template - так не называй. такое название говорит о том, что этот класс должен быть в папке Pun и файл называться Template.php
какой код вызывается когда ты получаешь эту ошибку?
#96. tipsun Off (19)
Moderator
2012.03.02 15:03
» #92 - вот там я все показал.
Без прослойки работает.
Хорошо, как назвать тогда? "include_template" = include/template.php
Отредактировано tipsun (2012.03.02 15:03)
#97. Gemorroj Off (107)
Administrator
2012.03.02 17:05
класс PunTemplate назови.
файл include/PunTemplate.php
#98. tipsun Off (19)
Moderator
2012.03.02 21:09
Ой бле! Вот я тормоз.
Метод надо так же как класс назвать, видимо. Сейчас попробую.
Код:
span style="color: #0000BB"><?phpclass Smarty_GuestBook extends Smarty { function Smarty_GuestBook() { // Конструктор класса. // Он автоматически вызывается при создании нового экземпляра. $this->Smarty(); $this->template_dir = '/web/www.example.com/guestbook/templates/'; $this->compile_dir = '/web/www.example.com/guestbook/templates_c/'; $this->config_dir = '/web/www.example.com/guestbook/configs/'; $this->cache_dir = '/web/www.example.com/guestbook/cache/'; $this->caching = true; $this->assign('app_name', 'Guest Book'); }}$smarty = new Smarty_GuestBook();
Отредактировано tipsun (2012.03.02 21:09)
#99. Gemorroj Off (107)
Administrator
2012.03.02 21:09
нее, это из времен php4. в php5 кошерно коструктор называть __construct
#100. tipsun Off (19)
Moderator
2012.03.02 21:09
Нет. Вот так получилось норм.
Код:
span style="color: #0000BB"><?php// include/template.phpif (! defined('PUN')) exit(); define('PUN_TEMPLATE', 1);require_once('Smarty/Smarty.class.php');class PunTemplate extends Smarty{ function PunTemplate($dir) { $this->__construct(); $this->template_dir = $dir . 'tpls/'; $this->compile_dir = $dir . 'compiled/'; $this->config_dir = $dir . 'configs/'; $this->cache_dir = $dir . 'cache/'; $this->assign('punDesignDir', $dir); }}// wap/header.phprequire_once(PUN_ROOT . 'include/template.php');$smarty = new PunTemplate(PUN_ROOT . 'include/template/wap/' . $pun_user['style_wap'] . '/');// wap/viewtopic.phprequire_once(PUN_ROOT . 'wap/header.php');
Добавлено спустя   3 минуты :
Gemorroj написал:
нее, это из времен php4. в php5 кошерно коструктор называть __construct
Да. smile
Нет - я говорил сам себе smile
Добавлено спустя   5 минут  35 секунд:
Ладно. Сейчас чуть по коду погуляю. Может че получится.
Отредактировано tipsun (2012.03.02 21:09)
Страниц: 18 9 10 11 1232 Все
Главная
WEB
PunBB Mod v0.6.2
0.020 s