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:
#2
RE: Adding views in modules
Hold off on this... I am not sure that is the way we want to go.
A redesign is already in the works.
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#3
RE: Adding views in modules
what redesign?

This would help us obly mastering more modules rendering and get closer to a standard mvc.

I will try to show a module modified this way.
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:
#4
RE: Adding views in modules
If we don't want to switch then extending ZPM to add views is possible and likely won't be too complicated. Compatibility could then be maintained with current modules (if desired).
Before posting, update your profile with your OS, Sentora version and server type!

Reply
Thanks given by:
#5
RE: Adding views in modules
(02-24-2016, 05:57 AM)jacobg830 Wrote: If we don't want to switch then extending ZPM to add views is possible and likely won't be too complicated. Compatibility could then be maintained with current modules (if desired).

adding views will not break the panel. It's more a convention. As will build html in /views/ and render them using mustache instead of building line .=. Can you easily modify such html trapped in variables?

On my side it was always a mess. This is why a lot of dev and frameworks got to MVC we are currently more MC dev.

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:


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 ,889 07-30-2019, 11:11 AM
Last Post: andrabcm
[WISH] Hookable methods on/for modules Bizarrus 0 3 ,143 03-23-2019, 06:32 AM
Last Post: Bizarrus
Reminder for modules devs Me.B 0 10 ,500 02-20-2016, 09:42 PM
Last Post: Me.B

Forum Jump:


Users browsing this thread: 1 Guest(s)