Page 1 of 1

[CTLModulemaker] [Template Externalizer] exports but doesn't save

Posted: Mon Sep 07, 2009 11:57 am
by louisk
I made a module with CTLModuleMaker and exported the modules with Template Externalizer, but when I save the templates, the changes are not reflected in the module templates (not saved to database), like with other modules.
Am I doing something wrong?

Re: [CTLModulemaker] [Template Externalizer] exports but doesn't save

Posted: Mon Sep 07, 2009 7:14 pm
by plger
I had never tried the externalizer with module templates, so after seeing your message I made several tests. Everything worked like a charm...

Re: [CTLModulemaker] [Template Externalizer] exports but doesn't save

Posted: Mon Sep 07, 2009 7:27 pm
by louisk
Aha, thanks.
So what do you thing the problem could be since it works with all other modules?
Some settings?
I tried changing the rights to the files and things like that, but no luck.

Re: [CTLModulemaker] [Template Externalizer] exports but doesn't save

Posted: Mon Sep 07, 2009 7:58 pm
by plger
The Externalizer's code is very straightforward... honestly I don't see any reason why it shouldn't work. If you wish, send me your module or module dna and I will investigate further.

Re: [CTLModulemaker] [Template Externalizer] exports but doesn't save

Posted: Tue Sep 08, 2009 3:46 pm
by louisk
Thanks, that really kind of you :)
Here is my dna (hmm that sounds strange)
Rename .xml to .dna

Re: [CTLModulemaker] [Template Externalizer] exports but doesn't save

Posted: Tue Sep 08, 2009 4:52 pm
by plger
I found the problem : your module name starts with a "v" :)    if you rename it "aideo", for example, it will work without a problem.

It's a bug in the Template Externalizer. The thing is, the import of external templates back into the db is done immediately when the Template Externalizer module is loaded - and the modules are loaded alphabetically. Which means that any module whose name come after "TemplateExternalizer" will never have its external templates imported, because they are not loaded yet and the Template Externalizer uses the loaded modules.
I will report this bug immediately.

Plger

Re: [CTLModulemaker] [Template Externalizer] exports but doesn't save

Posted: Tue Sep 08, 2009 5:06 pm
by plger
Posted: http://dev.cmsmadesimple.org/bug/view/4017
They should fix it quite easily. In the meanwhile, if you wish to fix it right away, you can slightly edit the file /modules/TemplateExternalizer/functions.externalizer.php
Around line 188 you should see :

Code: Select all

$modulenames = array_keys($gCms->modules);
Just replace this with :

Code: Select all

  $modulenames = array();
  $dbresult = $db->Execute("SELECT module_name FROM ".cms_db_prefix()."modules WHERE status='installed' AND active=1");
  while($dbresult && $row = $dbresult->FetchRow())	array_push($modulenames,$row["module_name"]);
And everything should be fine.

Re: [CTLModulemaker] [Template Externalizer] exports but doesn't save

Posted: Wed Sep 09, 2009 3:52 pm
by louisk
Wow, that's a nice bug  ;D
Good work finding it.
Thanks for the solution!