Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty 3 RC4 released
Goto page Previous  1, 2
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
terri
Smarty n00b


Joined: 15 Oct 2010
Posts: 2

PostPosted: Fri Oct 15, 2010 4:53 pm    Post subject: Reply with quote

Hello, I apologize for not knowing English, so they had to transfer through translate.google.ru

Trying to connect to the new Smarty3.0rc4 Yii Framework (yiiframework .com)

Download the extension (Extensions »smarty-view-renderer)
yiiframework .com/extension/smarty-view-renderer/

When you run the script, an error


Code:
    PHP Error
    Description

    include (Smarty_Internal_Data.php) [<a href='function.include'> function.include </ a>]: failed to open stream: No such file or directory
    Source code



file not found: smarty_internal_data.php
I renamed all 64 files as prescribed classes


===========
Smarty_Internal_Data.php
Smarty_Internal_Cache.php
Smarty_Internal_CacheResource_File.php
Smarty_Internal_Compile_Append.php
Smarty_Internal_Compile_Assign.php
Smarty_Internal_Compile_Block.php
Smarty_Internal_Compile_Break.php
Smarty_Internal_Compile_Call.php
Smarty_Internal_Compile_Capture.php
Smarty_Internal_Compile_Config_Load.php
Smarty_Internal_Compile_Continue.php
Smarty_Internal_Compile_Debug.php
Smarty_Internal_Compile_Eval.php
Smarty_Internal_Compile_Extends.php
Smarty_Internal_Compile_For.php
Smarty_Internal_Compile_Foreach.php
Smarty_Internal_Compile_Function.php
Smarty_Internal_Compile_If.php
Smarty_Internal_Compile_Include.php
Smarty_Internal_Compile_Include_Php.php
Smarty_Internal_Compile_Insert.php
Smarty_Internal_Compile_Ldelim.php
Smarty_Internal_Compile_Nocache.php
Smarty_Internal_Compile_Private_Block_Plugin.php
Smarty_Internal_Compile_Private_Function_Plugin.php
Smarty_Internal_Compile_Private_Modifier.php
Smarty_Internal_Compile_Private_Object_Block_Function.php
Smarty_Internal_Compile_Private_Object_Function.php
Smarty_Internal_Compile_Private_Print_Expression.php
Smarty_Internal_Compile_Private_Registered_Block.php
Smarty_Internal_Compile_Private_Registered_Function.php
Smarty_Internal_Compile_Private_Special_Variable.php
Smarty_Internal_Compile_Rdelim.php
Smarty_Internal_Compile_Section.php
Smarty_Internal_Compile_While.php
Smarty_Internal_CompileBase.php
Smarty_Internal_Config.php
Smarty_Internal_Config_File_Compiler.php
Smarty_Internal_Configfilelexer.php
....
===========


now there is another error:


Code:

SmartyCompilerException
Описание

Syntax Error in template "//usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/demos/new/themes/classic/views/layouts/manager.tpl" on line 2 "{$MEMORY}" unknown tag "private_print_expression"
Исходный код

/usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/demos/new/protected/vendors/Smarty/sysplugins/Smarty_Internal_TemplateCompilerBase.php(404)

00392:                 $exp_token = $this->parser->yyTokenName[$token];
00393:                 if (isset($this->lex->smarty_token_names[$exp_token])) {
00394:                     // token type from lexer
00395:                     $expect[] = '"' . $this->lex->smarty_token_names[$exp_token] . '"';
00396:                 } else {
00397:                     // otherwise internal token name
00398:                     $expect[] = $this->parser->yyTokenName[$token];
00399:                 }
00400:             }
00401:             // output parser error message
00402:             $error_text .= ' - Unexpected "' . $this->lex->value . '", expected one of: ' . implode(' , ', $expect);
00403:         }
00404: throw new SmartyCompilerException($error_text);
00405:     }
00406: }
00407: ?>

Содержимое стека

#0 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/demos/new/protected/vendors/Smarty/sysplugins/Smarty_Internal_TemplateCompilerBase.php(229): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown tag "pr...', 2)
#1 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/demos/new/protected/vendors/Smarty/sysplugins/Smarty_Internal_Templateparser.php(2176): Smarty_Internal_TemplateCompilerBase->compileTag('private_print_e...', Array)
#2 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/demos/new/protected/vendors/Smarty/sysplugins/Smarty_Internal_Templateparser.php(2623): Smarty_Internal_Templateparser->yy_r27()
#3 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/demos/new/protected/vendors/Smarty/sysplugins/Smarty_Internal_Templateparser.php(2723): Smarty_Internal_Templateparser->yy_reduce(28)
#4 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/demos/new/protected/vendors/Smarty/sysplugins/Smarty_Internal_SmartyTemplateCompiler.php(59): Smarty_Internal_Templateparser->doParse(0, 0)
#5 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/demos/new/protected/vendors/Smarty/sysplugins/Smarty_Internal_TemplateCompilerBase.php(83): Smarty_Internal_SmartyTemplateCompiler->doCompile('hh?{$MEMORY}')
#6 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/demos/new/protected/vendors/Smarty/sysplugins/Smarty_Internal_Template.php(271): Smarty_Internal_TemplateCompilerBase->compileTemplate(Object(Smarty_Internal_Template))
#7 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/demos/new/protected/vendors/Smarty/sysplugins/Smarty_Internal_Template.php(460): Smarty_Internal_Template->compileTemplateSource()
#8 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/demos/new/protected/vendors/Smarty/sysplugins/Smarty_Internal_Template.php(568): Smarty_Internal_Template->renderTemplate()
#9 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/demos/new/protected/vendors/Smarty/Smarty.class.php(328): Smarty_Internal_Template->getRenderedTemplate()
#10 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/demos/new/protected/extensions/Smarty/ESmartyViewRenderer.php(105): Smarty->fetch('/usr/home/admin...')
#11 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/framework/web/CBaseController.php(86): ESmartyViewRenderer->renderFile(Object(ManagerController), '/usr/home/admin...', Array, true)
#12 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/framework/web/CController.php(741): CBaseController->renderFile('/usr/home/admin...', Array, true)
#13 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/demos/new/protected/controllers/ManagerController.php(21): CController->render('main', Array)
#14 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/framework/web/actions/CInlineAction.php(50): ManagerController->actionIndex()
#15 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/framework/web/CController.php(300): CInlineAction->run()
#16 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/framework/web/CController.php(278): CController->runAction(Object(CInlineAction))
#17 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/framework/web/CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)
#18 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/framework/web/CWebApplication.php(324): CController->run('')
#19 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/framework/web/CWebApplication.php(121): CWebApplication->runController('manager')
#20 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/framework/base/CApplication.php(135): CWebApplication->processRequest()
#21 /usr/home/admin/domains/*****.ru/public_html/yii/yii-1.1.4.r2429/demos/new/index.php(17): CApplication->run()
#22 {main}

2010-10-15 00:36:05 Apache/1.3.41 (Unix) mod_ssl/2.8.31 OpenSSL/0.9.7e-p1 PHP/5.2.9 FrontPage/5.0.2.2510 Yii Framework/1.1.4



This error appears when the template insert any tag.

The problem occurs only on a Unix system. On Windows, no such problems.

--
yet why the names of *. php files in a directory sysplugins / lower case and not as a class name?
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat Oct 16, 2010 10:15 am    Post subject: Reply with quote

The Smarty3 loading functions converting all filenames to lowercase. Don't rename the files.

The problem is the include (Smarty_Internal_Data.php). Where does it come from? This file is autoloaded by Smarty. It should never be required to load it manually?
Back to top
View user's profile Send private message
terri
Smarty n00b


Joined: 15 Oct 2010
Posts: 2

PostPosted: Sat Oct 16, 2010 11:37 am    Post subject: Reply with quote

I understand very little English ((

lattice question here
yiiframework.ru/forum/viewtopic.php?f=3&t=1579&p=9665 # p9659

but I had to change the code Yii freymforki

changed the code in the function Yii
function autoload($className)

Code:
            $find_str = strpos($className, 'Smarty_');
            if ($find_str === false) {
               include($className.'.php');   
            } else {
               include(strtolower($className).'.php');
            }


to Russia

Проблему я смог решить только изменив код Yii фреймворка, в одном из файлов где происходит подключение классов, я добавил выше приведённый код, который, название класса изменяет в нижний регистр и затем его подключает.
Back to top
View user's profile Send private message
ziege
Smarty Rookie


Joined: 16 Aug 2005
Posts: 13

PostPosted: Fri Oct 29, 2010 5:27 pm    Post subject: Bug with assigning variables Reply with quote

Hi,

I have posted a bug regarding this topic before, and this was fixed with the RC4 release, but the following bug also occurs with the current release:

Template:
Code:
...
{foreach item=tmp from=$myvar}
    ...
    {$tmp}
    ...
{/foreach}
...
{myfunc ... assign=tmp}
{$tmp}
...


The myfunc is an own function that (optionally) assigns the result to a variable:
Code:
...
$smarty->assign($params['assign'], $value);
...


The second {$tmp} outputs the value of the last $tmp value from the foreach loop and not the result of the function call.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Oct 29, 2010 5:54 pm    Post subject: Reply with quote

Your {foreach} does create the variable $tmp is the local scope of the template. Local variable have higher priority over variables with same name assigned to the Smarty object.

The template object is passed as third parameter to plugins. You should assign the variable in your plugin to the template object.

Code:
function smarty_function_myfunc($params, $smarty, $template) {
....
$template->assign($params['assign'], $value);
....
}
Back to top
View user's profile Send private message
newbie78
Smarty Rookie


Joined: 11 Oct 2010
Posts: 6

PostPosted: Fri Oct 29, 2010 10:08 pm    Post subject: Reply with quote

when i write
Code:
{if !isSet( $arrSelect[$v.sys_name] )}

then i take error: unknown function "isSet"
located in: library\Smarty\sysplugins\smarty_internal_templatecompilerbase.php [404 line]

when isSet in lowercase
Code:
{if !isset( $arrSelect[$v.sys_name] )}
smarty work fine

maybe this is bug

i use rc4
thanks Very Happy
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Sat Oct 30, 2010 1:07 am    Post subject: Reply with quote

not a bug, isset() is a php function
Back to top
View user's profile Send private message Visit poster's website
ziege
Smarty Rookie


Joined: 16 Aug 2005
Posts: 13

PostPosted: Sat Oct 30, 2010 2:48 pm    Post subject: Reply with quote

U.Tews wrote:
Your {foreach} does create the variable $tmp is the local scope of the template. Local variable have higher priority over variables with same name assigned to the Smarty object.


Thanks, that fixed the problem. Wink
Back to top
View user's profile Send private message
newbie78
Smarty Rookie


Joined: 11 Oct 2010
Posts: 6

PostPosted: Sun Oct 31, 2010 8:29 pm    Post subject: Reply with quote

mohrt wrote:
not a bug, isset() is a php function

why does it work in lowercase, but in CaMeL it doesn't work?
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sun Oct 31, 2010 9:07 pm    Post subject: Reply with quote

The lexer/parser of Smarty needs to treat isset() and empty() in a special way as this are PHP language elements and no real functions. It's smarty currently looking only for lowercase writing.
Back to top
View user's profile Send private message
newbie78
Smarty Rookie


Joined: 11 Oct 2010
Posts: 6

PostPosted: Mon Nov 01, 2010 3:03 pm    Post subject: Reply with quote

U.Tews wrote:
The lexer/parser of Smarty needs to treat isset() and empty() in a special way as this are PHP language elements and no real functions. It's smarty currently looking only for lowercase writing.

okay, thanks!
Back to top
View user's profile Send private message
jaxon
Smarty n00b


Joined: 15 Nov 2010
Posts: 1

PostPosted: Mon Nov 15, 2010 8:32 pm    Post subject: Problem with (capture) in smarty 3.0.0 - 3.0.4 Reply with quote

Hi

I've got problem with {capture} tag in smarty 3.0.0 - 3.0.4. I've tested each.
There is NO error/notice in smarty 3 Beta 4 !
It's trivial php Notice but You know ... Smile

I have file "__head.tpl" :
(...)
{if $smarty.capture.html_header_dodatkowy!=''}{$smarty.capture.html_header_dodatkowy}{/if}
(...)

And file "cPageIndex.tpl" :
{* {capture name="html_header_dodatkowy"}{literal}{/literal}{/capture} *}
{include file="__head.tpl"}
(...)

As You can see capture is in comment.
I get: "Notice: Undefined index: capture in ...__head.tpl.php on line yyy"

And when in file "cPageIndex.tpl" is for example:
{capture name="html_header_dodatkowyXXX"}{literal}{/literal}{/capture}
I get:
"Notice: Undefined index: html_header_dodatkowy in ...__head.tpl.php on line yyy"

I can fix it myself but I'd like You to know the issue.


Best Regards
Jacek
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3 All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP