I was wondering if someone could point me to a source for information on adding conditional functionability to a template system.
I've come up with a system that uses html comment tags.
<!-- if: time_of_day > 12:00 -->
Good afternoon...
<!-- else -->
Good morning...
<!-- end_if: time_of_day > 12:00 -->
I'm using a regular expression to get this accomplished. However there is a problem, the problem being nested conditionals.
Problem:
<!-- if: time_of_day > 12:00 -->
<p>Good afternoon,
<!-- if: logged_in -->
Mr. Smith
<!-- else -->
esteemed guest
<!-- end_if: logged_in -->
<!-- else -->
Good morning...
<!-- end_if: time_of_day > 12:00 -->
One solution I've come up with is to add the conditional statement to the else comment tag.
Solution 1:
<!-- if: time_of_day > 12:00 -->
<p>Good afternoon,
<!-- if: logged_in -->
Mr. Smith
<!-- else: logged_in -->
esteemed guest
<!-- end_if: logged_in -->
<!-- else: time_of_day > 12:00 -->
Good morning...
<!-- end_if: time_of_day > 12:00 -->
Any further solutions to this problem would be greatly appreciated.