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

Problem z array i obiektem.

 
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 -> Language: Polish
View previous topic :: View next topic  
Author Message
bordeux
Smarty Rookie


Joined: 27 Jul 2010
Posts: 10

PostPosted: Tue Jul 27, 2010 3:43 pm    Post subject: Problem z array i obiektem. Reply with quote

Witam.
To co chce zrobić wygląda tak:
Code:

{if $Tablica[$ObiektDOM->getAttribute('admin')] == true }
cosik
{/if}

No i wywala mi tak błąd krytyczny:

Fatal error: Smarty error: [in view_show.tpl line 133]: syntax error: unidentified token '[$vMenu->getAttribute('admin')]' (Smarty_Compiler.class.php, line 1410) in E:\wamp\www\Xvweb\core\libraries\Smarty\Smarty.class.php on line 1093
Call Stack
# Time Memory Function Location
1 0.0024 359648 {main}( ) ..\index.php:0
2 0.0067 504008 include_once( 'E:\wamp\www\Xvweb\view.php' ) ..\index.php:18
3 0.1237 1889536 require( 'E:\wamp\www\Xvweb\index.php' ) ..\view.php:200
4 0.1255 2004600 include_once( 'E:\wamp\www\Xvweb\articles.php' ) ..\index.php:21
5 11.5820 4096528 Smarty->display( string(13), ???, ??? ) ..\articles.php:201
6 11.5821 4096624 Smarty->fetch( string(13), null, null, bool ) ..\Smarty.class.php:1106
7 11.5827 4096808 Smarty->_compile_resource( string(13), string(73) ) ..\Smarty.class.php:1254
8 11.5844 4098216 Smarty->_compile_source( string(13), string(302), null, string(73) ) ..\Smarty.class.php:1422
9 11.5853 4172816 Smarty_Compiler->_compile_file( string(13), string(302), null ) ..\Smarty.class.php:1489
10 11.6828 4286192 Smarty_Compiler->_compile_tag( string(215) ) ..\Smarty_Compiler.class.php:312
11 11.6832 4287728 Smarty_Compiler->_compile_if_tag( string(212), ??? ) ..\Smarty_Compiler.class.php:473
12 11.6903 4294632 Smarty_Compiler->_syntax_error( string(52), long, string(65), long ) ..\Smarty_Compiler.class.php:1410
13 11.6904 4294744 Smarty->_trigger_fatal_error( string(66), string(13), long, string(65), long, long ) ..\Smarty_Compiler.class.php:2256
14 11.6904 4295000 Smarty->trigger_error( string(134), long ) ..\Smarty.class.php:1815
15 11.6904 4295224 trigger_error ( string(148), long ) ..\Smarty.class.php:1093

Jak to ugryzc?
Back to top
View user's profile Send private message
fornve
Smarty Rookie


Joined: 25 Apr 2008
Posts: 29
Location: Sheffield, UK

PostPosted: Sat Sep 04, 2010 11:11 pm    Post subject: Reply with quote

Heja!

Try

Code:

{assign var=tableElement value=$Tablica.$ObiektDOM}
{if $tableElement->getAttribute('admin') == true}
cosik
{/if}


Niestety smarty (w wersji < 3) nie bardzo radzi sobie z zagniezdzonymi objektami w tablicach, choc to pod spodem powinno zadzialac:

Code:

{if $Tablica.$ObiektDOM->getAttribute('admin') == true }
cosik
{/if}


Ale assign zawsze wyprowadza z opresij Wink

Pozdrawiam,
Marek
Back to top
View user's profile Send private message Visit poster's website
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 -> Language: Polish All times are GMT
Page 1 of 1

 
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