Headlines | Halogy User Guide

Headlines

Headlines are a way of globally showing the latest items from modules, such as most recent blog posts or recent shop products. Headlines are generally used in Includes, for example in the Footer of a site, as a way to get users to visit the module regardless of what page they are currently on. As you cannot output module tags outside of the module, the headlines system becomes very useful for doing this.

Table of Contents


Using Headlines Within Templates

Headlines are looped tags, so they must be opened and closed with the same tag. For example in the code below you will see a template for a home page that shows the most recent blog posts (limited by 5). The headlines are opened with a tag, the repeatable markup is placed inside the loop and then headlines are closed with the same tag.

{headlines:blog:limit(5)}

    <div class="repeating">

        <div class="date">
            <span>{headline:day}</span><br />
            {headline:month}
        </div>
        <div class="body">

            <h2><a href="{headline:link}">{headline:title}</a></h2>

            <p>{headline:excerpt}</p>

            </div>

        </div>

    </div>

{/headlines:blog:limit(5)}

Shopping Cart Headlines

Headlines can also be used to output the shopping cart. For example you can show the items in your shopping cart as well as the total. This is useful for sites using the E-Commerce module. The same looped tag rules apply, though in the example below the tags are slightly different. Also in the example below you will see the use of 'conditional statements' to check that there are actually items in the cart first.

{ if headlines:shop:cartitems }
    <ul id="cart">
        {headlines:shop:cartitems}
            <li>
                <a href="{headline:link}">{headline:title}</a><br />
                <small>({headline:quantity}x - {headline:price})</small>
            </li>
        {/headlines:shop:cartitems}
    </ul>

    <p>Total: <strong>{headlines:shop:subtotal}</strong></p>
{ else }
    <p>Your cart is empty.</p>
{ /if } 

NOTE: Spaces would need to be removed from the conditional tags.


Tag Reference

{headlines:MODULE} - Show headlines based on module reference
{headlines:MODULE:category(REFERENCE)} - Shows headlines based on category
{headlines:MODULE:category(REFERENCE):limit(5)} - Shows headlines based on category with a limit
{headlines:shop:cartitems} - Show headlines for shopping cart
{headline:title} - Title of headline (e.g. the blog post)
{headline:link} - Link to the headline article
{headline:date} - Date that headline article was posted
{headline:day} - Day the headline article was posted (DD)
{headline:month} - Month the headline article was posted (MMM)
{headline:year} - Year the headline article was posted (YY)
{headline:body} - Body of the headline article
{headline:excerpt} - Excerpt of the headline article
{headline:comments} - Number of comments the headline article has (for Blog module)
{headline:author} - Full name of the author of the headline article
{headline:author-id} - ID of the author of the headline article
{headline:quantity} - Quantity of item in the cart (for Shop module)
{headline:price} - Price of item in the cart (for Shop module)
{headline:class} - Alternate class of the headline (e.g. even articles get a class of 'alt')