|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I thought I had seen this somewhere on the site but I have been looking
all morning. Is there a simple way to display the last mod date of a template? Robert |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Fri, Mar 17, 2006 at 10:01:01AM -0500, Robert Hicks wrote:
> I thought I had seen this somewhere on the site but I have been looking > all morning. > > Is there a simple way to display the last mod date of a template? No, AFAIK there is not *simple* way. A not so simple way would be using smarty's internal Smarty::_fetch_resource_info() function. But this one is internal and not dokumented. You may have to figure it out yourself and there is no warrenty that it's API may not change some day (though it is very unlikely that it may change in Smarty-2.x) > Robert > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFEGtHoubKPpFA4n0URAmWFAJ4qo8lvBXN1I9YupDQ+x+ Gn/IMy3wCfUvXt 87V/1D5ssTPs9W6p6HRUiXY= =5EXa -----END PGP SIGNATURE----- |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Change the $filename variable to the path and filename of your template
file: ---- BEGIN PHP CODE -------- $filename = "templates/index.tpl"; $smarty->assign('filemodified', date ("F d Y H:i:s.", filemtime($filename))); ------ END PHP CODE --------- ----- BEGIN TEMPLATE CODE ----- File last modified on {$filemodified} ----- END TEMPLATE CODE ------ On 3/17/06, Robert Hicks <sigzero@gmail.com> wrote: > > I thought I had seen this somewhere on the site but I have been looking > all morning. > > Is there a simple way to display the last mod date of a template? > > Robert > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Evan Wagner wrote:
> Change the $filename variable to the path and filename of your template > file: > > ---- BEGIN PHP CODE -------- > $filename = "templates/index.tpl"; > $smarty->assign('filemodified', date ("F d Y H:i:s.", > filemtime($filename))); > ------ END PHP CODE --------- > > ----- BEGIN TEMPLATE CODE ----- > File last modified on {$filemodified} > ----- END TEMPLATE CODE ------ > > On 3/17/06, Robert Hicks <sigzero@gmail.com> wrote: Thank you! Robert |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Fri, Mar 17, 2006 at 10:51:08AM -0500, Robert Hicks wrote:
> Evan Wagner wrote: > >Change the $filename variable to the path and filename of your template > >file: > > > > ---- BEGIN PHP CODE -------- > >$filename = "templates/index.tpl"; > >$smarty->assign('filemodified', date ("F d Y H:i:s.", > >filemtime($filename))); > >------ END PHP CODE --------- > > > >----- BEGIN TEMPLATE CODE ----- > >File last modified on {$filemodified} > >----- END TEMPLATE CODE ------ of course this doesn't work transparently with your smarty configuration and it does not word for resources. > >On 3/17/06, Robert Hicks <sigzero@gmail.com> wrote: > > Thank you! > > Robert > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFEGvw6ubKPpFA4n0URAlCIAKCSM+1v3XVlE8upSJjAqV PT9kKpZwCfbMWh KpF8Wjw835GedTTFyGTkmFg= =Maol -----END PGP SIGNATURE----- |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
{flamewar}I think it works fine{/flamewar}
On 3/17/06, messju mohr <messju@lammfellpuschen.de> wrote: > > On Fri, Mar 17, 2006 at 10:51:08AM -0500, Robert Hicks wrote: > > Evan Wagner wrote: > > >Change the $filename variable to the path and filename of your template > > >file: > > > > > > ---- BEGIN PHP CODE -------- > > >$filename = "templates/index.tpl"; > > >$smarty->assign('filemodified', date ("F d Y H:i:s.", > > >filemtime($filename))); > > >------ END PHP CODE --------- > > > > > >----- BEGIN TEMPLATE CODE ----- > > >File last modified on {$filemodified} > > >----- END TEMPLATE CODE ------ > > of course this doesn't work transparently with your smarty > configuration and it does not word for resources. > > > >On 3/17/06, Robert Hicks <sigzero@gmail.com> wrote: > > > > Thank you! > > > > Robert > > > > -- > > Smarty General Mailing List (http://smarty.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
On Fri, Mar 17, 2006 at 01:23:41PM -0500, Evan Wagner wrote:
> {flamewar}I think it works fine{/flamewar} yes it does work fine. but it does answer the wong question. it answers "how can i display the modification time of a local file?" and not "how can I display the modification time of a smarty template?". > On 3/17/06, messju mohr <messju@lammfellpuschen.de> wrote: > > > > On Fri, Mar 17, 2006 at 10:51:08AM -0500, Robert Hicks wrote: > > > Evan Wagner wrote: > > > >Change the $filename variable to the path and filename of your template > > > >file: > > > > > > > > ---- BEGIN PHP CODE -------- > > > >$filename = "templates/index.tpl"; > > > >$smarty->assign('filemodified', date ("F d Y H:i:s.", > > > >filemtime($filename))); > > > >------ END PHP CODE --------- > > > > > > > >----- BEGIN TEMPLATE CODE ----- > > > >File last modified on {$filemodified} > > > >----- END TEMPLATE CODE ------ > > > > of course this doesn't work transparently with your smarty > > configuration and it does not word for resources. > > > > > >On 3/17/06, Robert Hicks <sigzero@gmail.com> wrote: > > > > > > Thank you! > > > > > > Robert > > > > > > -- > > > Smarty General Mailing List (http://smarty.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFEGwJfubKPpFA4n0URAqSdAJ9TYRLfK1rrgf86NAPsed UMfUbadwCdGke7 cSq8hCJnZnwwhGbM2RkreqI= =risc -----END PGP SIGNATURE----- |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
messju mohr wrote:
> On Fri, Mar 17, 2006 at 01:23:41PM -0500, Evan Wagner wrote: >> {flamewar}I think it works fine{/flamewar} > > yes it does work fine. but it does answer the wong question. it > answers "how can i display the modification time of a local file?" and > not "how can I display the modification time of a smarty template?". > For "my" purposes, they are one and the same. : ) Robert |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
Hi everyone,
I often need to use var inside array. Example: $poste = array("1"=>"poste1", "2"=>"poste2", "3"=>"poste3"); $offre = array("1"=>array("nom"=>"myname","id_poste"=>"1")) ; (result from a db query) I assign these array to smarty. Then into smarty: {$poste[1]} => Poste1; {$offre[1].nom} => myname {$offre[1].id_poste} => 1 But {$poste[$offre[1].id_poste]} result to an error. I try many syntax, but cant achieve my objective. Is there's a way ? Or I need to do it into php (I do it most of time, but not very appropriate in whole case). Regards, Alexandre Cognard |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
instead of {$poste[$offre[1].id_poste]}
which the smarty parser dont like try assigning the array_key to a variable first {assign var=array_key value=$offre[1].id_poste} {$poste[$array_key]} regards Pete Alexandre Cognard wrote: > Hi everyone, > > I often need to use var inside array. > > Example: > $poste = array("1"=>"poste1", "2"=>"poste2", "3"=>"poste3"); > $offre = array("1"=>array("nom"=>"myname","id_poste"=>"1")) ; (result from a > db query) > > I assign these array to smarty. > > Then into smarty: > {$poste[1]} => Poste1; > > {$offre[1].nom} => myname > {$offre[1].id_poste} => 1 > > But {$poste[$offre[1].id_poste]} result to an error. > I try many syntax, but cant achieve my objective. > > Is there's a way ? Or I need to do it into php (I do it most of time, but > not very appropriate in whole case). > > Regards, > Alexandre Cognard |
|
|
|
#11 |
|
Messages: n/a
Hébergeur: |
Work fine, thanks !
Can we hope a better integration of array in future ? Smarty is greatful ![]() -----Message d'origine----- De: Pedro [mailto:daffodil@daffodil.uk.com] Envoyé: lundi 20 mars 2006 17:02 À: smarty-general@lists.php.net Objet: [SMARTY] Re: Variable into smarty array instead of {$poste[$offre[1].id_poste]} which the smarty parser dont like try assigning the array_key to a variable first {assign var=array_key value=$offre[1].id_poste} {$poste[$array_key]} regards Pete Alexandre Cognard wrote: > Hi everyone, > > I often need to use var inside array. > > Example: > $poste = array("1"=>"poste1", "2"=>"poste2", "3"=>"poste3"); > $offre = array("1"=>array("nom"=>"myname","id_poste"=>"1")) ; (result from a > db query) > > I assign these array to smarty. > > Then into smarty: > {$poste[1]} => Poste1; > > {$offre[1].nom} => myname > {$offre[1].id_poste} => 1 > > But {$poste[$offre[1].id_poste]} result to an error. > I try many syntax, but cant achieve my objective. > > Is there's a way ? Or I need to do it into php (I do it most of time, but > not very appropriate in whole case). > > Regards, > Alexandre Cognard -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
|
#12 |
|
Messages: n/a
Hébergeur: |
--- Alexandre Cognard <alexandre@reseaulocal.fr> wrote:
> Work fine, thanks ! > > Can we hope a better integration of array in future ? > > Smarty is greatful ![]() > > -----Message d'origine----- > De�: Pedro [mailto:daffodil@daffodil.uk.com] > Envoy�: lundi 20 mars 2006 17:02 > �: smarty-general@lists.php.net > Objet�: [SMARTY] Re: Variable into smarty array > > instead of {$poste[$offre[1].id_poste]} > > which the smarty parser dont like > > try assigning the array_key to a variable first > {assign var=array_key value=$offre[1].id_poste} > {$poste[$array_key]} This should also work: {$poste[$offre.1.id_poste]} -- boots > regards > > Pete > > Alexandre Cognard wrote: > > Hi everyone, > > > > I often need to use var inside array. > > > > Example: > > $poste = array("1"=>"poste1", "2"=>"poste2", "3"=>"poste3"); > > $offre = array("1"=>array("nom"=>"myname","id_poste"=>"1")) ; (result from > a > > db query) > > > > I assign these array to smarty. > > > > Then into smarty: > > {$poste[1]} => Poste1; > > > > {$offre[1].nom} => myname > > {$offre[1].id_poste} => 1 > > > > But {$poste[$offre[1].id_poste]} result to an error. > > I try many syntax, but cant achieve my objective. > > > > Is there's a way ? Or I need to do it into php (I do it most of time, but > > not very appropriate in whole case). > > > > Regards, > > Alexandre Cognard __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
|
|
|
#13 |
|
Messages: n/a
Hébergeur: |
Hi,
I'm on my first project using Smarty and have been wondering: html_select_date has the option of having an empty option selected when first opening a page. I would like to have the same when using html_options. However I do understand how to use this: <select name="type_id"> <option value='null'>-- none --</option> {html_options name=type options=$cust_options selected=$type_id} </select> This will give me two select tags, one inside the other am I right? Does not seem easy to work with. Any suggestions? Thanks for your . Wojciech Duda |
|
|
|
#14 |
|
Messages: n/a
Hébergeur: |
Wojciech Duda wrote:
> <select name="type_id"> > <option value='null'>-- none --</option> > {html_options name=type options=$cust_options selected=$type_id} > </select> > > > This will give me two select tags, one inside the other am I right? Does not > seem easy to work with. > > Try instead: <select name="type_id"> <option value='null'>-- none --</option> {html_options options=$cust_options selected=$type_id} </select> Note that I removed the "name=type" from html_options. If you put it in, Smarty generates the <select> tags accordingly. If you don't, it doesn't. -- Mark Rogers More Solutions Ltd :: 0845 45 89 555 |
|
![]() |
| Outils de la discussion | |
|
|