-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Calendar
Store
Posts posted by Tyapkin
-
-
Привет!
Пишу сюда. Надеюсь, что поможете с решением моей проблемы.
Собственно суть в том, что занимаюсь по книге Кристиана Дари "PHP и MySQL создание интернет-магазина". В ней разрабатывается магазин с применением Smarty 2. Я же решил делать все на Smarty 3.1.7. И теперь жалею.
Остановился на главе 4, где разрабатывается вывод категорий в боковой панели. Все сделал правильно, но почему-то не работает. Выдает следующую ошибку:
ERRNO: 2
TEXT: filemtime() [function.filemtime]: stat failed for C:\xampp\htdocs\tshirtshop/presentation/templates_c\df30bd3fe4c2a44000f41d088095b9e3b6f58816.file.departments_list.tpl.php
LOCATION: C:\xampp\htdocs\tshirtshop\libs\smarty\sysplugins\smarty_resource.php, line 685, at January 10, 2012, 2:07 pm
Showing backtrace:
filemtime("C:\xampp\htdocs\tshirtshop/presentation/templates_c\df30bd3fe4c2...") # line 685, file: C:\xampp\htdocs\tshirtshop\libs\smarty\sysplugins\smarty_resource.php
Smarty_Template_Source.getCompiled(Object: Smarty_Internal_Template) # line 646, file: C:\xampp\htdocs\tshirtshop\libs\smarty\sysplugins\smarty_internal_template.php
Smarty_Internal_Template.__get("compiled") # line 154, file: C:\xampp\htdocs\tshirtshop\libs\smarty\sysplugins\smarty_internal_templatebase.php
Smarty_Internal_TemplateBase.fetch(null, null, null, null, false, false, true) # line 285, file: C:\xampp\htdocs\tshirtshop\libs\smarty\sysplugins\smarty_internal_template.php
Smarty_Internal_Template.getSubTemplate("departments_list.tpl", null, null, null, null, Array[0], "0") # line 48, file: C:\xampp\htdocs\tshirtshop\presentation\templates_c\92ce319d57bad138f13edc147f44af22817a8aa7.file.store_front.tpl.php
content_4f05b2746c3aa(Object: Smarty_Internal_Template) # line 180, file: C:\xampp\htdocs\tshirtshop\libs\smarty\sysplugins\smarty_internal_templatebase.php
Smarty_Internal_TemplateBase.fetch("store_front.tpl", null, null, null, true) # line 374, file: C:\xampp\htdocs\tshirtshop\libs\smarty\sysplugins\smarty_internal_templatebase.php
Smarty_Internal_TemplateBase.display("store_front.tpl") # line 22, file: C:\xampp\htdocs\tshirtshop\index.phpМне кажется, что ошибка кроется где здесь:
// Ссылка на библиотеку Smarty
require_once SMARTY_DIR . 'Smarty.class.php';
/* Класс, расширяющий Smarty, используется для обработки
и отображения файлов Smarty */
class Application extends Smarty {
// Конструктор класса
public function __construct(){
// Вызов конструктора Smarty
parent::__construct();
// Меняем папки шаблонов по умолчанию
$this->setTemplateDir(TEMPLATE_DIR);
$this->setCompileDir(COMPILE_DIR);
$this->setConfigDir(CONFIG_DIR);
$this->addPluginsDir(array('SMARTY_DIR/plugins', 'PRESENTATION_DIR/smarty_plugins'));
}
}Или здесь (файл шаблона для списка категорий):
{* departments_list.tpl *}
{load_presentation_object filename="departments_list" assign="obj"}
{* Начало списка отделов *}
<div class="box">
<p class="bot-title">Список отделов</p>
<ul>
{* Перебираем элементы списка отделов *}
{section name=i loop=$obj->mDepartments}
{assign var=selected value=""}
{* Проверяем, выделен ли отдел, чтобы определить, какой стиль CSS использовать *}
{if ($obj->mSelectedDepartment == $obj->mDepartments[i].department_id)}
{assign var=selected value="class=\"selected\""}
{/if}
<li>
{* Генерируем ссылку для нового отдела в списке *}
<a {$selected} href="{$obj->mDepartments[i].link_to_department}">
{$obj->mDepartments[i].name}
</a>
</li>
{/section}
</ul>
</div>
{* Конец списка отделов *}Всем заранее спасибо.
-
Это будет интересно.
Ошибка функции filemtime() Smarty 3.1.7 и PHP
in PHP
Posted · Edited by Tyapkin
Нет, на сайте книги нет решения данной проблемы.
Но я решил эту проблему.
Вот кодъ application.php
По поводу языкового барьера, есть гугл транслейт