1
costi
How do you develop your modules?
  • 2003/10/15 14:27

  • costi

  • Just popping in

  • Posts: 15

  • Since: 2003/9/12


I'm a newbie in XOOPS API and development. I started to develop a module and things are going slow.

What's annoying me the most is that I have to click to "update module" everytime I change a template. Am I stupid or there is another, much easier way? I worked before with smarty templates, and smarty detected when I modified the template and updated templates_c automatically. There is an option in XOOPS to make it behave this way?

And I don't get it why the templates are in a database when it's much easyer and faster on a filesystem.

2
Coplan
Re: How do you develop your modules?
  • 2003/10/15 17:53

  • Coplan

  • Just popping in

  • Posts: 51

  • Since: 2002/10/2


Honestly, I havn't tried to mess with anything else. There might be an option for that, but I havn't even thought to try.

Personally, my templates tend to be very simple. For example, the module I'm working on right now has a standard header and a standard footer. Then the body is dynamic. Sometimes its a table, other times its just a few paragraphs or lists. So I tend to just have a smarty variable to hold everything in the body. Once that template is done, I reload the module (it reloads the template), and then I can code the behavior of said body, and I don't have to reload the module again through this process. I just reload the page in my browser as you would with any other PHP development project.

OUt of curiosity, there is an option in the system options to read/update templates from the disk. Does that affect module templates? Or is that just for themes? I'd try it myself, but I'm at work, and my 2.0.x installation isn't public for me to check.

3
mrgym
Re: How do you develop your modules?
  • 2003/10/16 14:51

  • mrgym

  • Just popping in

  • Posts: 28

  • Since: 2002/4/26


I agree that the update module or delete template-upload template is a pain. I'm not sure whether this is done because the template is then remotely editable via an HTML form, or because there is some interaction between the template and the chosen theme.

I did see a note under the 2.0.4 or 2.0.5 release that said that the system->general preferences "Update module template .html files from themes/your theme/templates directory?"" now worked. If you look at the XOOPS table tplfile you will see a field called "tpl_lastmodified" which looks like a timestamp. It's easy to imagine a date check on the files in your module subdirectory (in XOOPS > 2.0.3) where the newly-updated templates are used rather than the ones in the database.


4
ackbarr
Re: How do you develop your modules?

I'd guess that the reason for db stored smarty templates is to allow for multiple template sets.

As far as how I go about developing my modules, I usually minimize this problem by developing my templates first. This gives me an idea of what Smarty variables I will need to achieve the layout I want. Then I work backwards from there, creating scripts that would interact with my objects and fill the smarty variables, then lastly I create the objects.

5
costi
Re: How do you develop your modules?
  • 2003/10/16 19:11

  • costi

  • Just popping in

  • Posts: 15

  • Since: 2003/9/12


Quote:
I did see a note under the 2.0.4 or 2.0.5 release that said that the system->general preferences "Update module template .html files from themes/your theme/templates directory?"" now worked. If you look at the XOOPS table tplfile you will see a field called "tpl_lastmodified" which looks like a timestamp.


I have that specific option turned on. I did a grep on XOOPS files and found
grep -Rl tpl_lastmodified trubadur.usr.ro/
trubadur.usr.ro/class/smarty/plugins/resource.db.php
trubadur
.usr.ro/kernel/tplfile.php
trubadur
.usr.ro/modules/system/admin/modulesadmin/main.php
trubadur
.usr.ro/modules/system/admin/modulesadmin/modulesadmin.php
trubadur
.usr.ro/modules/system/admin/tplsets/main.php
trubadur
.usr.ro/modules/system/admin/tplsets/tplform.php


I tracked down the error to the file class/smarty/plugins/resource.db.php, line 42:
if ($filepath != "" && file_exists($filepath)) {


I've put the usual "die debug messages" and before the line with "if..." die($filepath) echoes something like this:
/home/costi/trubadur.usr.ro/themes//templates/system/blocks/system_block_user.html

You see that are two slashes, and file_exists() test fails. I have a XOOPS 2.03 upgraded consecutively (is that an english word?) to 2.04 and 2.05.

6
skalpa
Re: How do you develop your modules?
  • 2003/10/16 19:14

  • skalpa

  • Quite a regular

  • Posts: 300

  • Since: 2003/4/16


There's an option to do this, although it doesn't work in any released version

However, it has been fixed in CVS so it will be ok for next one.
If you can't wait for it, you can get the fixed file (it's resource.db.php) from the CVS repository and copy it manually over the actual one (be careful however: I'm sure you can use it and that it will work with a 2.0.5 kernel, but can't say anything about previous versions).

Once installed: disable theme/tpl caching in System admin / preferences (it's the option called update templates from...).
Then, if you're using the "default" theme, XOOPS will check for an updated version of your templates in /modules/yourmod/templates/ .
Or if you're using a theme called, i.e "mytheme", it will look in /themes/mytheme/templates/yourmod/ .

IMHO: For dev purposes, use the default theme. Otherwise each time you update your module it will recompile the files in the /modules/.... directory, even if you have updated them in /themes/.... , so it's still a bit boring.

Skalpa.>

7
costi
Re: How do you develop your modules?
  • 2003/10/16 19:28

  • costi

  • Just popping in

  • Posts: 15

  • Since: 2003/9/12


Quote:
If you can't wait for it, you can get the fixed file (it's resource.db.php) from the CVS repository


Off course I need it now. I got module development to do, man! Thanks, it works now. Magic!

Login

Who's Online

249 user(s) are online (177 user(s) are browsing Support Forums)


Members: 0


Guests: 249


more...

Donat-O-Meter

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

Latest GitHub Commits