This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Adding views in modules
#1
Adding views in modules
Currently the modules folders structure is:

- assets (for images/css/js).
- code ( for main module php core).
- hooks ( sentora daemon related code).

The common way of building html to concatenate html in the module currently.

Issue:

Changing the design is  complicated. 

Solution:
Adding a new folder:
- views

Where we store store views partials and load them using MUSTACHE:
https://github.com/bobthecow/mustache.php

The rendering would be like:
Code:
$m = new Mustache_Engine;
echo $m->render(mytemplate, array('vars' => 'values!'));



We could also move later to handlebars, mustache views could easily used by JS too later as there is a mustache parser in JS:

http://mustache.github.io/
https://github.com/janl/mustache.js 

I plan already to add Mustche in /etc/lib as I will use it for Apache Admin module and vhosts building.

M B
No support using PM (Auto adding to IGNORE list!), use the forum. 
How to ask

200$ free to start your VPS 60 days credit
Reply
Thanks given by:


Messages In This Thread
Adding views in modules - by Me.B - 02-20-2016, 10:23 PM
RE: Adding views in modules - by TGates - 02-22-2016, 07:08 PM
RE: Adding views in modules - by Me.B - 02-22-2016, 08:15 PM
RE: Adding views in modules - by jacobg830 - 02-24-2016, 05:57 AM
RE: Adding views in modules - by Me.B - 02-24-2016, 07:35 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Application Error: [0204] - problems when adding an A Record of more than 65 A record andrabcm 8 21 ,873 07-30-2019, 11:11 AM
Last Post: andrabcm
[WISH] Hookable methods on/for modules Bizarrus 0 3 ,142 03-23-2019, 06:32 AM
Last Post: Bizarrus
Reminder for modules devs Me.B 0 10 ,495 02-20-2016, 09:42 PM
Last Post: Me.B

Forum Jump:


Users browsing this thread: 3 Guest(s)