Loading...
 
Features / Usability

Features / Usability


Using PHP/JS in templates

posts: 7 United States

I'm wanting to add a suggestion box to the tiki pages using a module. This suggestion box would send the comments to an email address of our ticketing solution. I made the template file but it doesn't seem to be working.

How does Tiki handle that kind of code when parsing tpl files? Will this even be possible to do with Tiki's architecture? A copy of the code I wrote is attached. Thank you for your help.

posts: 8633 Israel

Mmm...

I pretty sure you can do this without a template and you will have much more control over it using custom module.

Create a new custom module at tiki-admin_modules.php#content_admin_modules1-2
Add your code (wiki syntax, html, jq, js, smarty, etc) and set where, how and who using the module parameters.

I would also consider using a tracker to store and manage the suggestions.
It will make everything simpler and the Tiki way.

You can then use tracker monitoring or notification (or plugin notification). Those will send automatically an email to address(es) when new item is created, form is sent, item is modified, etc.


posts: 7 United States

well, I thought making a template *for* a custom module is what I was doing. I tried the same code in the .tpl file in the control panel, and tiki seemed to comment out the PHP that was in it. When the page loads, there's a stray '> in the rendering of it.

Can you write JS and PHP there? Or just HTML?