View previous topic :: View next topic |
Author |
Message |
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Mar 05, 2010 3:59 pm Post subject: Smarty 3 Beta 8 Released |
|
|
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 |
|
ZakMc Smarty Pro
Joined: 04 Oct 2004 Posts: 182
|
Posted: Mon Mar 08, 2010 9:23 am Post subject: |
|
|
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 |
|
smartybug Smarty Rookie
Joined: 18 Jan 2010 Posts: 14
|
Posted: Mon Mar 08, 2010 10:45 am Post subject: |
|
|
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 |
|
ZakMc Smarty Pro
Joined: 04 Oct 2004 Posts: 182
|
Posted: Mon Mar 08, 2010 10:56 am Post subject: |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Mar 08, 2010 2:26 pm Post subject: |
|
|
As the post states above, read the README. |
|
Back to top |
|
ZakMc Smarty Pro
Joined: 04 Oct 2004 Posts: 182
|
Posted: Mon Mar 08, 2010 2:50 pm Post subject: |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Mar 08, 2010 3:14 pm Post subject: |
|
|
I see, setters/getters were not implemented on separately created templates. This is updated in the SVN. |
|
Back to top |
|
ZakMc Smarty Pro
Joined: 04 Oct 2004 Posts: 182
|
Posted: Mon Mar 08, 2010 4:08 pm Post subject: |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Mar 08, 2010 4:20 pm Post subject: |
|
|
(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 |
|
ZakMc Smarty Pro
Joined: 04 Oct 2004 Posts: 182
|
Posted: Tue Mar 09, 2010 9:03 am Post subject: |
|
|
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
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Mar 09, 2010 3:15 pm Post subject: |
|
|
fixed in SVN |
|
Back to top |
|
neng Smarty n00b
Joined: 12 Mar 2010 Posts: 3
|
Posted: Fri Mar 12, 2010 9:29 am Post subject: $smarty->cache->clear - doesn't work ? |
|
|
$smarty->cache->clear(index, 'main');
doesn't work ? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Mar 12, 2010 3:44 pm Post subject: |
|
|
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 |
|
neng Smarty n00b
Joined: 12 Mar 2010 Posts: 3
|
Posted: Sat Mar 13, 2010 5:02 am Post subject: |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sat Mar 13, 2010 6:20 pm Post subject: |
|
|
Was a cache created for index.tpl under the 'main' cache_id to begin with? |
|
Back to top |
|
|