For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > August 2005 > Re: [SMARTY] Storing variables in the cache









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 Re: [SMARTY] Storing variables in the cache
Ivo Jansch

2005-08-29, 7:56 am

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Ivo Jansch wrote:

> I remember vaguely that it was possible to put data (php variables) in
> Smarty's cache along with the cached template (for example to store the
> time at witch the data in the cache was actually modified).
>
> I can't find it in the manual though. How can I make it work?


anybody?

- --
Ivo Jansch <ivo@ibuildings.nl>
ibuildings.nl BV - information technology
http://www.ibuildings.nl
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDEwHf95NUnGFZm9cRAifXAJsG7WD/TKxsSrSIXNHPGkS22KiY7wCfVUUG
9ecrwbuyU3NfVlX6hHIiYiw=
=G1k9
-----END PGP SIGNATURE-----
boots

2005-08-29, 7:02 pm

--- Ivo Jansch <ivo@ibuildings.nl> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> Ivo Jansch wrote:
>
>
> anybody?


Hi Ivo. I'm not exactly sure what you mean by this. Perhaps you are
thinking about cache_attrs on plugins?

http://smarty.php.net/manual/en/caching.cacheable.php

Otherwise I'm not aware of any general in-built facility to
serialize/unserialize php data to and from the cache.

Greetings.



________________________________________
____________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs

messju mohr

2005-08-29, 7:02 pm

On Mon, Aug 29, 2005 at 02:38:55PM +0200, Ivo Jansch wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> Ivo Jansch wrote:
>
>
> anybody?


do $smarty->assign() inside {insert} or a non-cacheable function.


> - --
> Ivo Jansch <ivo@ibuildings.nl>
> ibuildings.nl BV - information technology
> http://www.ibuildings.nl
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (MingW32)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
> iD8DBQFDEwHf95NUnGFZm9cRAifXAJsG7WD/TKxsSrSIXNHPGkS22KiY7wCfVUUG
> 9ecrwbuyU3NfVlX6hHIiYiw=
> =G1k9
> -----END PGP SIGNATURE-----
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

Ivo Jansch

2005-08-29, 7:02 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

boots wrote:

> Hi Ivo. I'm not exactly sure what you mean by this. Perhaps you are
> thinking about cache_attrs on plugins?


No, what I mean is something like this:

if ($smarty->is_cached("test.tpl"))
{
$last_modified = $smarty->getVariable("test.tpl", "last_modified");
)
else
{
$last_modified = doSomeComplexStuffToDetermineLastModific
ationDate();
$smarty->setVariable("last_modified", $last_modified);
}
$smarty->render("test.tpl");

echo "Last modification = ".$last_modified;

In other words, I not only want to store the template output in the
cache, but also some meta data along with it.

Greetings,
Ivo

- --
Ivo Jansch <ivo@ibuildings.nl>
ibuildings.nl BV - information technology
http://www.ibuildings.nl
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDEzB595NUnGFZm9cRAoZWAJ417qcAQvrr
5OayQ5688LFHrrWOGwCg69xL
NCbQRLHcF0rPo2NVZH+eORE=
=uImj
-----END PGP SIGNATURE-----
Sponsored Links







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

Copyright 2008 codecomments.com