Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Smarty 3 Beta 8 Released
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
mohrt
Administrator


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

PostPosted: Fri Mar 05, 2010 3:59 pm    Post subject: Smarty 3 Beta 8 Released Reply with quote

The eighth beta of Smarty 3 has been released! Please join the developer mailing list and see the Smarty 3 section of the forums and give us feedback!

NOTE: There are some important changes to Beta 8. Most notably, the API has been refactored in favor of a more consistent and modular syntax. Many of the Smarty 2 APIs are deprecated (but still work.) See the README for details.

http://www.smarty.net/
Back to top
View user's profile Send private message Visit poster's website
ZakMc
Smarty Pro


Joined: 04 Oct 2004
Posts: 182

PostPosted: Mon Mar 08, 2010 9:23 am    Post subject: Reply with quote

I made an update from beta 7 to beta 8. Now I have an error:

Code:

$Template = $smarty->createTemplate( '/MessageBox/status' , 'MessageBox|' . $_SESSION['usernr'] );
$Template->caching = true;
$Template->cache_lifetime = 86400;
if( $Template->isCached() )
{
   return $Template->fetch();
}
...


Quote:
Notice: function call 'loadCacheResource' is unknown or deprecated. in /var/www/pages/cogos152/includes/extern/smarty/sysplugins/smarty_internal_wrapper.php on line 57

Exception: unknown method 'loadCacheResource' in /var/www/pages/cogos152/includes/extern/smarty/sysplugins/smarty_internal_wrapper.php on line 117


How do I change the code so that it works in Beta 8?

Thx
Back to top
View user's profile Send private message
smartybug
Smarty Rookie


Joined: 18 Jan 2010
Posts: 11

PostPosted: Mon Mar 08, 2010 10:45 am    Post subject: Reply with quote

Quote:

// some API calls are moved into their own objects:
$smarty->cache->loadResource($type = null)

So you have to find and change 'loadCacheResource' call.


Last edited by smartybug on Wed May 05, 2010 11:19 pm; edited 1 time in total
Back to top
View user's profile Send private message
ZakMc
Smarty Pro


Joined: 04 Oct 2004
Posts: 182

PostPosted: Mon Mar 08, 2010 10:56 am    Post subject: Reply with quote

smartybug wrote:
So you have to find and change 'loadCacheResource' call.


This call is in "$Template->isCached()". How do I change this??? Itīs a Smarty component.
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Mon Mar 08, 2010 2:26 pm    Post subject: Reply with quote

As the post states above, read the README.
Back to top
View user's profile Send private message Visit poster's website
ZakMc
Smarty Pro


Joined: 04 Oct 2004
Posts: 182

PostPosted: Mon Mar 08, 2010 2:50 pm    Post subject: Reply with quote

mohrt wrote:
As the post states above, read the README.


Thx, I read it.

But where is something about my problem?

I try this

ReadMe:
Code:
$smarty->setCaching(true);


php:
Code:
$Template->setCaching();

Quote:
Fatal error: Call to undefined method Smarty_Internal_Template::setCaching()


ReadMe:

Quote:
A template object can be created by using the createTemplate method. It has the
same parameter assignments as the fetch() or display() method.
Function definition:
function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null)

The first parameter can be a template name, a smarty object or a data object.
....


Nothing find with caching.

Where will be in the readme??
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Mon Mar 08, 2010 3:14 pm    Post subject: Reply with quote

I see, setters/getters were not implemented on separately created templates. This is updated in the SVN.
Back to top
View user's profile Send private message Visit poster's website
ZakMc
Smarty Pro


Joined: 04 Oct 2004
Posts: 182

PostPosted: Mon Mar 08, 2010 4:08 pm    Post subject: Reply with quote

I download the svn version but still have the error

php:

Code:
$Template = $smarty->createTemplate( '/MessageBox/status' , 'MessageBox|' . $_SESSION['usernr'] );
$Template->setCaching( true );
$Template->setCacheLifetime( 86400 );
if( $Template->isCached() )
{
   return $Template->fetch();
}
...


error:

Quote:
Smarty_Internal_Template->isCached( ) ../Message.php:67
Smarty->loadCacheResource( ) ../smarty_internal_template.php:341
Smarty->__call( $name = 'loadCacheResource', $args = array () ) ../Smarty.class.php:0
Smarty_Internal_Wrapper->convert( $name = 'loadCacheResource', $args = array () ) ../Smarty.class.php:753
trigger_error ( 'function call \'loadCacheResource\' is unknown or deprecated.', 1024 ) ../smarty_internal_wrapper.php:57


i found nothing in the readme. how do i fix this?
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Mon Mar 08, 2010 4:20 pm    Post subject: Reply with quote

(another SVN change made, please update)

as for deprecated method loadCacheResource, use $this->cache->loadResource(). the README has the new API listed.
Back to top
View user's profile Send private message Visit poster's website
ZakMc
Smarty Pro


Joined: 04 Oct 2004
Posts: 182

PostPosted: Tue Mar 09, 2010 9:03 am    Post subject: Reply with quote

I have now downloaded the latest version, but still have problems.

test.php
Code:

<?php
require_once './smarty/Smarty.class.php';

$sm = new Smarty();
$sm->setTemplateDir( './templates' );
$sm->display( 'test.tpl' );
?>


test.tpl
Code:
I am a test file


output:
Quote:
Notice: Indirect modification of overloaded property Smarty_Internal_Template::$smarty has no effect in /var/www/pages/cogos152/includes/extern/smarty/sysplugins/smarty_internal_template.php on line 86


Quote:
Fatal error: Cannot assign by reference to overloaded object in /var/www/pages/cogos152/includes/extern/smarty/sysplugins/smarty_internal_template.php on line 86
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Tue Mar 09, 2010 3:15 pm    Post subject: Reply with quote

fixed in SVN
Back to top
View user's profile Send private message Visit poster's website
neng
Smarty n00b


Joined: 12 Mar 2010
Posts: 3

PostPosted: Fri Mar 12, 2010 9:29 am    Post subject: $smarty->cache->clear - doesn't work ? Reply with quote

$smarty->cache->clear(index, 'main');

doesn't work ?
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Fri Mar 12, 2010 3:44 pm    Post subject: Reply with quote

the first param should be the template file name, like 'index.tpl', and the second param is the cache group. Is that how you have caching setup? Otherwise, clearAll() will just clear all caches.
Back to top
View user's profile Send private message Visit poster's website
neng
Smarty n00b


Joined: 12 Mar 2010
Posts: 3

PostPosted: Sat Mar 13, 2010 5:02 am    Post subject: Reply with quote

Sorry I'm typing wrong

Code:
$smarty->cache->clear('index.tpl', 'main');

I try to use this command. But can not be clear

but clearAll() , it's work
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Sat Mar 13, 2010 6:20 pm    Post subject: Reply with quote

Was a cache created for index.tpl under the 'main' cache_id to begin with?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3 All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
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