For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > November 2004 > smarty block - defining the function









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author smarty block - defining the function
Jed R. Brubaker

2004-11-04, 8:57 pm

This one should be easy. I am certain that I am missing something.

I have a SmartyConfig class that extends Smarty and sets application level
variables (directories, security, etc.).

I am now trying to create a block that simply avoids caching, but I would
like to have it somewhere in my SmartyConfig class.

If I have it in the constructor, I get this error:

{nocache:af0e435caa9a7868f76ea427d2429a7
9#0}
Fatal error: Non-static method SmartyConfig::noCache_block() cannot be
called statically in
c:\web\www\smarty\compile\%%31^31B^31BB5
478%%featuredTitles.tpl.php on line
5

If I have it in the class but not in the constuctor, I get this error:

Fatal error: Smarty error: [in email/featuredTitles.tpl line 1]:
[plugin] block 'noCache' is not implemented (core.load_plugins.php, line 36)
in c:\web\www\php\classes\smarty\Smarty.class.php on line 1088

The only way I have been able to get it to work is if the function is
defined outisde a class. I am pretty sure this is because the function needs
to be global. Is there anyway to make that not be? Can I create a block
wholly inside a class? How wouldthe register_block() look?

Thanks!
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com