PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.smarty.general > Same template filename in multiple directories in path
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Same template filename in multiple directories in path

Réponse
 
LinkBack Outils de la discussion
Vieux 22/09/2006, 11h33   #1
Mark Rogers
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Same template filename in multiple directories in path

I'm sure I should know the answer to this, but I can't find it:

I have multiple directories in my template path, which will vary on
multiple calls to my script, but there's always a default template
directory. All of them contain a file "index.tpl", so depending on the
template path for any given call to my script I will be targetting a
different index.tpl.

It seems[*] that they all compile to the same file in templates_c, so I
generally get the last compiled version of the wrong template.

How do I fix this?
[*] I'm debugging this remotely and that's the conclusion I've reached;
the site is currently using v2.6.3. If an upgrade will fix it or this
just shouldn't be happening anyway I'll look for other problems in my code.

--
Mark Rogers
More Solutions Ltd
  Réponse avec citation
Vieux 22/09/2006, 11h45   #2
Saliga Gábor
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RE: [SMARTY] Same template filename in multiple directories in path

| -----Original Message-----
| From: Mark Rogers [mailto:mark@quarella.co.uk]
| Sent: Friday, September 22, 2006 11:33 AM
| To: smarty-general@lists.php.net
| Subject: [SMARTY] Same template filename in multiple
| directories in path
|
|
| I'm sure I should know the answer to this, but I can't find it:
|
| I have multiple directories in my template path, which will
| vary on multiple calls to my script, but there's always a
| default template directory. All of them contain a file
| "index.tpl", so depending on the template path for any given
| call to my script I will be targetting a different index.tpl.
|
| It seems[*] that they all compile to the same file in
| templates_c, so I generally get the last compiled version of
| the wrong template.
|
| How do I fix this?
|
|[*] I'm debugging this remotely and that's the conclusion
| I've reached; the site is currently using v2.6.3. If an
| upgrade will fix it or this just shouldn't be happening
| anyway I'll look for other problems in my code.
|
| --
| Mark Rogers
| More Solutions Ltd

Hello,

It think you should set a different templates_c directory for each template
directory.

I mean:
$smarty->compile_dir = 'different in every case';

Regards,
Gábor Saliga
  Réponse avec citation
Vieux 22/09/2006, 16h03   #3
Owen Cole
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] Same template filename in multiple directories in path

If you are not using caching you simply need to set a $compile_id that
is based upon the current template directory that you are using.
http://smarty.php.net/manual/en/variable.compile.id.php

If you are using caching and could possibly have multiple sets of data
displayed from the same template (under the same $compile_id), then you
would add in a custom $cache_id.

This will allow for multiple caches of the same template, but with
different versions.

http://smarty.php.net/manual/en/cach...ple.caches.php

Good luck!

Owen


Saliga Gábor wrote:
> | -----Original Message-----
> | From: Mark Rogers [mailto:mark@quarella.co.uk]
> | Sent: Friday, September 22, 2006 11:33 AM
> | To: smarty-general@lists.php.net
> | Subject: [SMARTY] Same template filename in multiple
> | directories in path
> |
> |
> | I'm sure I should know the answer to this, but I can't find it:
> |
> | I have multiple directories in my template path, which will
> | vary on multiple calls to my script, but there's always a
> | default template directory. All of them contain a file
> | "index.tpl", so depending on the template path for any given
> | call to my script I will be targetting a different index.tpl.
> |
> | It seems[*] that they all compile to the same file in
> | templates_c, so I generally get the last compiled version of
> | the wrong template.
> |
> | How do I fix this?
> |
> |[*] I'm debugging this remotely and that's the conclusion
> | I've reached; the site is currently using v2.6.3. If an
> | upgrade will fix it or this just shouldn't be happening
> | anyway I'll look for other problems in my code.
> |
> | --
> | Mark Rogers
> | More Solutions Ltd
>
> Hello,
>
> It think you should set a different templates_c directory for each template
> directory.
>
> I mean:
> $smarty->compile_dir = 'different in every case';
>
> Regards,
> Gábor Saliga
>
>

  Réponse avec citation
Vieux 22/09/2006, 16h43   #4
messju mohr
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] Same template filename in multiple directories in path

On Fri, Sep 22, 2006 at 10:03:13AM -0400, Owen Cole wrote:
> If you are not using caching you simply need to set a $compile_id that
> is based upon the current template directory that you are using.
> http://smarty.php.net/manual/en/variable.compile.id.php
>
> If you are using caching and could possibly have multiple sets of data
> displayed from the same template (under the same $compile_id), then you
> would add in a custom $cache_id.


not really. you can work around the problem by using a distinct
$compile_id regardless of caching. (it works transparently with caching enabled).

nevertheless I'd prefer to use different compile_dirs for different
template_dirs. or just use one template_dir and use
display('subdir1/index.tpl') and display('subdir2/index.tpl') which
are then distinct inside *one* compile_die.

greetings
messju

> This will allow for multiple caches of the same template, but with
> different versions.
>
> http://smarty.php.net/manual/en/cach...ple.caches.php
>
> Good luck!
>
> Owen
>
>
> Saliga Gábor wrote:
> >| -----Original Message-----
> >| From: Mark Rogers [mailto:mark@quarella.co.uk]
> >| Sent: Friday, September 22, 2006 11:33 AM
> >| To: smarty-general@lists.php.net
> >| Subject: [SMARTY] Same template filename in multiple
> >| directories in path
> >|
> >|
> >| I'm sure I should know the answer to this, but I can't find it:
> >|
> >| I have multiple directories in my template path, which will
> >| vary on multiple calls to my script, but there's always a
> >| default template directory. All of them contain a file
> >| "index.tpl", so depending on the template path for any given
> >| call to my script I will be targetting a different index.tpl.
> >|
> >| It seems[*] that they all compile to the same file in
> >| templates_c, so I generally get the last compiled version of
> >| the wrong template.
> >|
> >| How do I fix this?
> >|
> >|[*] I'm debugging this remotely and that's the conclusion
> >| I've reached; the site is currently using v2.6.3. If an
> >| upgrade will fix it or this just shouldn't be happening
> >| anyway I'll look for other problems in my code.
> >|
> >| --
> >| Mark Rogers
> >| More Solutions Ltd
> >
> >Hello,
> >
> >It think you should set a different templates_c directory for each template
> >directory.
> >
> >I mean:
> >$smarty->compile_dir = 'different in every case';
> >
> >Regards,
> >Gábor Saliga
> >
> >

>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 16h44.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12173 seconds with 12 queries