RTC_WebPackageManager and RTC_WebForum are really good examples, that I had learned a lot from.
What I want to achieve is, my web server could process any template file(which maybe include another templates by read them into placeholders, or inherits another template by fill itself into placeholders of parent template) without hard-code.
template include:
<% include('header.html') %>
I can use TRtcScript to implement(create a function "include", just load it and return the content):
<? include('header.html') ?>
template inheritance:master.html(pseudo-code):
<html>
<body>
<div class="body">
<% block body %>BODY<% endblock body %>
</div>
<div class="footer">
<% block footer %>FOOTER<% endblock footer %>
</div>
</html>
child.html(pseudo-code):
<% inherits('master.html') %>
<% block body %>
Hello.
<% endblock body %>
<% block footer %>
copyrights
<% endblock footer %>
Like you said, template is just a plain file with placeholders at present, so it's hard to do the block replacement.
So I describe the relationships like I mentioned:
<html>
<body>
<div class="body">
<% body %>
</div>
<div class="footer">
<% footer %>
</div>
</html>
child.conf:
master_template=master.html
body=child_body.html
footer=child_footer.html
But the problems:
1. the placeholder is not a block, so it could not have default content.
2. must break all blocks into many child_X template files(hard to maintain), instead of write the content of which block will be filled with in one file.
3. it's not easy to do multilevel inheritance.
I wonder is there any possible to provide extra events/methods or metadata for TRtcParse, so I could do the block replacement trick.
Any advice and suggestions will be greatly appreciated.