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

Static Object Access

 
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
caoimhin
Smarty Rookie


Joined: 08 Nov 2009
Posts: 24
Location: Lebbeke, Belgium

PostPosted: Fri Jan 01, 2010 7:41 pm    Post subject: Static Object Access Reply with quote

What is the best solution to call a static object in smarty?

Let's say I want to use Bla::something() in my template and it outputs a string.
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Sat Jan 02, 2010 12:47 pm    Post subject: Reply with quote

In SMarty3 you can access static classes directly.

{Bla::something()} to output the result.
Back to top
View user's profile Send private message
caoimhin
Smarty Rookie


Joined: 08 Nov 2009
Posts: 24
Location: Lebbeke, Belgium

PostPosted: Tue Jan 05, 2010 11:29 pm    Post subject: Reply with quote

U.Tews wrote:
In SMarty3 you can access static classes directly.

{Bla::something()} to output the result.


The answer I was looking for, thnx ! I cannot test it right now, but does it work with namespaces too?
Back to top
View user's profile Send private message
caoimhin
Smarty Rookie


Joined: 08 Nov 2009
Posts: 24
Location: Lebbeke, Belgium

PostPosted: Fri Jan 08, 2010 12:34 pm    Post subject: Reply with quote

caoimhin wrote:
U.Tews wrote:
In SMarty3 you can access static classes directly.

{Bla::something()} to output the result.


The answer I was looking for, thnx ! I cannot test it right now, but does it work with namespaces too?


I guess it's not ..
Back to top
View user's profile Send private message
caoimhin
Smarty Rookie


Joined: 08 Nov 2009
Posts: 24
Location: Lebbeke, Belgium

PostPosted: Thu Jan 21, 2010 12:28 pm    Post subject: Reply with quote

No solution for this?
Back to top
View user's profile Send private message
caoimhin
Smarty Rookie


Joined: 08 Nov 2009
Posts: 24
Location: Lebbeke, Belgium

PostPosted: Wed Mar 17, 2010 8:22 am    Post subject: Reply with quote

Up ..
Back to top
View user's profile Send private message
caoimhin
Smarty Rookie


Joined: 08 Nov 2009
Posts: 24
Location: Lebbeke, Belgium

PostPosted: Mon Jun 21, 2010 12:26 pm    Post subject: Reply with quote

Guys? Sad
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Mon Jun 21, 2010 3:31 pm    Post subject: Reply with quote

I don't think namespaces are supported yet.
Back to top
View user's profile Send private message Visit poster's website
saboya
Smarty Rookie


Joined: 24 Jun 2010
Posts: 6

PostPosted: Thu Jun 24, 2010 4:32 pm    Post subject: Reply with quote

I've written a patch for namespace support, may help you until the Smarty devs implement it:

http://www.smarty.net/forums/viewtopic.php?t=17582
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Thu Jun 24, 2010 8:39 pm    Post subject: Reply with quote

syntax. The goal of Smarty is to speparate the design as much as possible from the business logic. With namespace syntax we would more and more of business logic into the templates.

Instead ou can register a class with optional namespace for the use in the template like:
Code:
$smarty->register->templateClass('foo','name\name2\myclass');


And use it in the template
Code:
{foo::method()}


This modification is in the SVN now.
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
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