Trongate Docs
switch to dark modeswitch to dark mode
»
»
Best Practices

Best Practices

It's widely accepted, throughout the web development community, that view files should contain a minimum amount of PHP code. Echoing (displaying) variables, looping through rows of data (perhaps to display rows on a table), formatting dates and even an occasional IF statement are all acceptable.

In the case of the Trongate framework, calling other modules from within view files is considered to be acceptable as well. However, this is something that can be easily achieved using just one line of PHP code.  More about that later!

Trongate lets you the developer decide how to build your apps.  Since we're using pure PHP, you have access to a wide assortment of PHP functionality from within your view files.  

Nevertheless, for the purposes of having a clear separation of concerns, developers are encouraged to keep view files simple.  This means having few lines of PHP code, whenever possible. 

an example of some code from a view file

Top Tip
Keep complex PHP code and database queries inside your controller files!



HELP & SUPPORT

If you have a question or a comment relating to anything you've see here, please goto the Help Bar.

 
×