-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a content function #178
Comments
Yes, that was going to be my next addition but I was also thinking about other ways we could handle the if statement. The alternative would be attributes: <div visible="data(foo)=bar"> But I don't think that's quite so clear. Or In this example, we'd also need to support if/else which again poses a slight issue: <if data="loggedin" equals="true">
<then>
You are logged in
</then>
<else>
Sorry, you must log in to view this page
</else>
</if> But we could make the if[equals][data(attr(data))=attr(value)] { content: content('then'); }
if[equals][data(attr(data))!=attr(value)] { content: content('else'); } it would be up to the individual implementer to decide on the the exact syntax but this would open up some possibilities. |
This whole if/else bit makes me wonder if Transphporm is planning to depart from its original vision of having no code in templates. |
Absolutely, the point I wanted to make is that you can design your own traditional template engine using transphporm as a backend. At the moment Transphporm can already do 95% of it so adding a couple of extra features to nudge it up to 100% isn't really a lot of effort. Really, it's just a way to show off some of the features of the language in a way that people coming from smarty/twig/whatever will easily grasp edit: But in light of your comment, I will add that caveat to the wiki page to make it clear that this isn't encouraged! |
weirdly that entire wiki page is vanished for me and i can't even view the revision history edit (again!) nevermind, the link in the nav was wrong, I've corrected it. |
@TomBZombie I saw your recent amendment to the wiki and was wondering if we will add the content function you use in the example.
The text was updated successfully, but these errors were encountered: