In PHP PHP can be the templating langauge. It seems to work well for that with no need for a templating system/language.
But, I can’t find anything similar looking with Python for the language. How do you do things like:
I took this from another unrelated SO question:
<?php foreach( $dates as $year => $year_content ): ?>
<h2><?php echo $year ?></h2>
<?php foreach( $year_content['months'] as $months ): ?>
<h3><?php echo $months->month ?> - <?php echo $months->sales ?></h3>
<?php endforeach; ?>
<?php endforeach; ?>
I just couldn’t find anything like this for “native” Python in the web view without someone’s framework. Thanks.
EDIT: No offense. Did not want a templating language.
EDIT: Despite the downvotes, a case in point is Python 3. While there is a five year expectancy to have 2.x users going to 3.x, not all templating languages support 3.x. Jinja, for example, has “expiremental” 3.x support. Why would I use that? I wouldn’t. That makes me dependent upon them, where I’d like to be able to use things native, but alas, it appears I cannot.
Python has no native templating in the sense that PHP has. You can use Python as an ISAPI extension, which would give you syntax like
<% print "foo" %>. Alternatively, you can write python scripts in pure CGI. Those roads are probably quite painful, and you’ll be better served using frameworks – frameworks give you the advantage of other developers’ experience as well as smoothing out the rough edges of dealing directly with CGI and HTTP.Please see my answer to a similar question asked earlier.