Latest articles
Latest articles of category




Content.tpl


content.tpl is related with displaying a short description of the articles of the category or category/subcategory selected. Moreover, if you have selected a category you can view the subcategories of it, accompanied with the number of articles belonging to each subcategory itself. A 'read more' link is displayed in order to link to the article.tpl where the main body of each article is displayed.

If the user has administrator, author or Super author access the code below gives the possibillity to add an article at the page:

{if ($userlevel_name eq 'Authors') or ($userlevel_name eq 'Super Authors') or ($admin eq 1)}
    {if $smarty.get.subcategory_name eq ''}
    <a href="{$smarty.const.WEBSITE_ROOT}/cms/articles/authorsArticle.php?action=add&category_name={$s_category_name}" rel="gb_page_center[700,600]">{t}Add article{/t}</a><br/><br/>
    {else}
    <a href="{$smarty.const.WEBSITE_ROOT}/cms/articles/authorsArticle.php?action=add&category_name={$s_category_name}&subcategory_name={$s_subcategory_name}" rel="gb_page_center[700,600]">{t}Add article{/t}</a>
    {/if}
{/if}

when there are no acticles to display:

{if $paginate.total <1}
<p></p>
    {t}There are no articles in this category!{/t}

otherwise this is the content which displays the description of these articles and a read more link :

{section name=content loop=$results}
    {if $results[content].hide_title eq '0'}
    <h1>{$results[content].title}</h1><br />
    {/if}
    {$results[content].description}

    {if $results[content].hide_maintext eq '0'}

        {if $results[content].subcategory_name eq ''}
            <a href="{$smarty.const.WEBSITE_ROOT}/{$smarty.session.session_lang}/{$results[content].category_name|urlencode|urlencode}/{$results[content].seo_title|urlencode|urlencode}.html">
        {else}
            <a href="{$smarty.const.WEBSITE_ROOT}/{$smarty.session.session_lang}/{$results[content].category_name|urlencode|urlencode}/{$results[content].subcategory_name|urlencode|urlencode}/{$results[content].seo_title|urlencode|urlencode}"><br/><br/>
        {/if}
        <div class="white12">{t}Read more{/t}<br><br></a></div>
    {/if}
    {/section}

This content includes pagination for easy navigation when there are too many articles to display

{paginate_prev} {paginate_middle format="page"} {paginate_next}

     <br />
    {if $paginate.size gt 1}
      Items {$paginate.first} - {$paginate.last} of {$paginate.total} displayed.
    {else}
      Item {$paginate.first} of {$paginate.total} displayed.
    {/if}

Finally, there is a link which redirectes to the home page

<a href="{$smarty.const.WEBSITE_ROOT}/{$smarty.session.session_lang}/index.php">{t}Back to Home page{/t}</a>
Posted on: 23/03/2011