1
srmcatee
Smarty Templates - Auto Recompile
  • 2006/8/2 11:28

  • srmcatee

  • Just popping in

  • Posts: 63

  • Since: 2005/8/22


Hello,

I'm working with Smart templates and I wonder if there is anyway to "auto-recompile" them. When I make a template change the onlyway to see it is to run an update of my module from the administrator screen.

Is there any easier way to do this?
Steve
ChurchLedger.com - A Xoops Module Developer

2
McNaz
Re: Smarty Templates - Auto Recompile
  • 2006/8/2 12:58

  • McNaz

  • Just can't stay away

  • Posts: 574

  • Since: 2003/4/21


Hi,

Xoops Admin -> General Settings -> Check templates for modifications ? set to yes. This will recompile any changed smarty template files.

HTH.

3
srmcatee
Re: Smarty Templates - Auto Recompile
  • 2006/8/3 1:44

  • srmcatee

  • Just popping in

  • Posts: 63

  • Since: 2005/8/22


Hi,

I'm referring to the templates directory under modules. Not the templates directory in themes.

Is there a setting to recompile the templates in this directory?
Steve
ChurchLedger.com - A Xoops Module Developer

4
McNaz
Re: Smarty Templates - Auto Recompile
  • 2006/8/3 7:17

  • McNaz

  • Just can't stay away

  • Posts: 574

  • Since: 2003/4/21


Quote:
I'm referring to the templates directory under modules.


I was referring to BOTH the theme templates AND module templates. This setting recompiles both.

5
Dave_L
Re: Smarty Templates - Auto Recompile
  • 2006/8/3 11:22

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


At some point, that behavior was changed.

In XOOPS 2.0.14, that setting causes recompilation of all templates, including module templates.

In XOOPS 2.2.4, module templates do not get recompiled.

I've been planning to figure out why, but haven't got around to it.

6
kaotik
Re: Smarty Templates - Auto Recompile
  • 2006/8/3 15:23

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


I'd also like to know how to fix this in 2.2.4 I've been going through the code tring to find where templates are checked. I'll post here if I find a solution.

7
conrad10781
Re: Smarty Templates - Auto Recompile
  • 2006/8/4 13:03

  • conrad10781

  • Just popping in

  • Posts: 2

  • Since: 2006/8/1 1


Quote:

kaotik wrote:
I'd also like to know how to fix this in 2.2.4 I've been going through the code tring to find where templates are checked. I'll post here if I find a solution.



I am a 2.0 User, but know SMARTY, etc... There is a smarty command

$smarty->force_compile true


Will overwrite template files each time they are called normally this is for a development server and should not be used on a live server.. You should be able to include the smarty class into your module php file, and then run that command.

I am pretty sure that is the code that is behind 2.0's admin setting

8
Dave_L
Re: Smarty Templates - Auto Recompile
  • 2006/8/4 19:30

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


In XOOPS 2.2.4, I've tried setting force_compile = true in various places, without any effect. I suspect it may be the way that XOOPS overrides Smarty's template handling (the source templates are stored in the database). The force_compile variable may cause the template to get recompiled from the database, but what needs to happen is forcing the template stored in the database to get updated from the file on disk.

9
birdseed
Re: Smarty Templates - Auto Recompile
  • 2006/8/5 10:19

  • birdseed

  • Just popping in

  • Posts: 59

  • Since: 2005/2/26


Hi

In order to have auto compilation for 2.2.4, you have to make a hack...

In class/smarty/plugins/resource.db.php

Change every line

if ($conf_theme != 'default') {

to

if(!in_array($conf_theme, 'default', 'your theme'))

This allows to keep 'your theme' templates in the modules/xxx/template dir

greetings
bsm

10
Dave_L
Re: Smarty Templates - Auto Recompile
  • 2006/8/5 15:31

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Thanks, birdseed.

I just did a test (without your hack), and found that the problem does not occur with the default theme, but only with other themes.

Login

Who's Online

410 user(s) are online (312 user(s) are browsing Support Forums)


Members: 0


Guests: 410


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits