You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to integrate many PHP codes into html, can Snow just parse codes between tag or ? This will make Snow much more flexible and very helpful to me.
The text was updated successfully, but these errors were encountered:
Well, I don't like this meshing of display, data and logic that PHP favors so much, since it will make code a lot more difficult to read, maintain and in general doesn't follow coding best-practices. So I won't add <?snow ... ?> for HTML files (that's what templates are meant for).
I would recommend to use the MVC pattern on those codes you'd like to add to HTML. Because then you can just continue using Mustache without sacrificing proper division of labor and responsibilities in the code. For example, if you have functionality like this in PHP:
<ul>
<? if ($_SERVER["REMOTE_IP"] > 127 && count($mydata->queryCustomer($_SESSION["id"])) > 0) { ?>
<li>Real user logged in</li>
<? } ?>
</ul>
You could turn that into a proper data function (coming from a class or just from an array):
I need to integrate many PHP codes into html, can Snow just parse codes between tag or ? This will make Snow much more flexible and very helpful to me.
The text was updated successfully, but these errors were encountered: