Add parameters to your includes
I started using simple-html-template recently, it's great.
However, it would be even greater if you could pass some parameters to your includes.
Example
index.html
...
<include src="partial/breadcrumb.html" title="Home" />
...
partial/breadcrumb.html
...
<variable name="title" />
...
This would result to Home being displayed inside the breadcrumb partial template.
Interesting. Since I'm beginner in node.js , could you add properly into code the fixes I mentioned in my published issues? I know they are very simple for experienced programmers in this area. I just do not want to make stupid mistakes. Please take a look what I published long time ago in the Issues section.
I tried to contact with the author, but he doesn't care...
@xdon82 I see no real need to add support for PHP files, since you can already use include in PHP natively. I also can't reproduce your other issue about the Windows platform.
I mix php with html in some files. So If php code is included in html where the header (including menu) is repetive, then it will be changed automatically when I change that included part - body-header.html for instance. If you have better idea how to do it, please show me an example
or rather i was supposed to say when html is included in php , but the idea is the same...
Use <?php include ('body-header.html'); ?> instead of <include src="body-header.html"/> in your PHP files.
See the official PHP documentation
hmm tbh you are right, I don't know why I made it much more complicated :P I think i wanted to keep it in one way (the template system) but as you noticed it doesn;t make sense
thx
btw should the code be triggered automatically on partial file change ? It doesn't work for me
@xdon82 This is only a feature request, it's not working yet.
Thank you guys for the suggestion. Please feel free to create PRs, I am quite busy at work right now, I will take a look when I have the capacity. Thanks!