(if you need professional help in implementing Smarty template engine, you can contact me here).
In our last series part 7A, we created the parent template for our application. In this series, we will be creating the about.tpl, categories.tpl, index.tpl, and latest.tpl.
filename: web/themes/default/about.tpl
{% *Copyright: Lorenzo D. Alipio* %} {% extends file="web/themes/default/main.tpl" %} {% block name=title %}About Us{% /block %} {% block name=meta %}{% /block %} {% block name=metad %}{% /block %} {% block name=general %} {% $content.about %} {% $content.name %} {% $content.email %} {% /block %}
filename: web/themes/default/categories.tpl
{% extends file="web/themes/green/main.tpl" %} {% block name=title %}Music Video Categories{% /block %} {% block name=meta %}{% /block %} {% block name=metad %}{% /block %} {% block name=general %} <h1 class="title" >{% $content.categoryHeader %}</h1>{% /block %}{% foreach from=$content.cat item=cat %}
- {% $cat|strip %}
{% /foreach %}
filename: web/themes/default/index.tpl
{% *2013 Copyright Lorenzo D. Alipio <ldalipio@msn.com>* %} {% extends file="web/themes/default/main.tpl" %} {% block name=title %}About Us{% /block %} {% block name=meta %}{% /block %} {% block name=metad %}{% /block %} {% block name=general %} <div class="span8"> <h4 class="title" >About this Demo Script</h1> {% $content.content['first_p'] %} <ul> {% foreach $content.content['lists'] as $item %} <li>{% $item %}</li> {% /foreach %} </ul> <h5 class="title">Additional Information</h5> <br/> {% $content.content['more_info'] %} <br/> </div> <div class="span4"> <h4 class="title">Demo Map</h5> <ul> <li><a href="categories.php"><h5 class="title">Categories</h5></a></li> <li><a href="toprated.php"><h5 class="title">Top Rated</h5></a></li> <li><a href="mostviewed.php"><h5 class="title">Most Viewed</h5></a></li> <li><a href="latest.php"><h5 class="title">Latest Video</h5></a></li> </ul> </div> {% /block %}
filename: web/themes/default/latest.tpl
{% extends file="web/themes/green/main.tpl" %} {% block name=title %}{% /block %} {% block name=meta %}{% /block %} {% block name=metad %}{% /block %} {% block name=title %}{% /block %} {% block name=thumb %} <h3 class="title">Video Count {% $content.count %}</h3> <div id = "thumb2"> <ul> {% section name=item loop=$content.video %} <li> <a href="play.php?vid={% $content.video[item].v_id %}&title={% $content.video[item].title|escape:'htmlall' %}&cat={% $content.cat %}"><img src="{% $content.video[item].thumb %}"/></a> <br/> {% $content.video[item].title %} <br/> {% $content.video[item].desc %} <br/> </li> {% /section %} </ul> </div> {% /block %} {% block name=paginate %}{% $content.pagination %}{% /block %}
Noticed the codes above, all of our template files inherited the properties of the main.tpl file and filled the blocks as needed on the page.
No comments:
Post a Comment