content (array) (web page)
Term | Data Type | Typical Output | Description |
---|---|---|---|
content.title | varchar | My Page | The page title |
content.type | varchar | webpage | The content type, ie article or webpage |
content.body | html | My page content in HTML etc.. | The page content in HTML |
Usage
<div class="container">
<div class="row">
<div class="col-sm-12"> {{ content.body|raw }}
</div>
</div> </div>
content (array) (blog article)
news and blog contents can be accessed via the same array that delivers web page content. Blogging article content is triggered when viewing a blogging or news article. The content.type parameter will be set to "article", however the same template that is used for web pages will be used. You can use an if statement in Twig to differentiate between webpages and blogging articles.
Term | Data Type | Typical Output | Description |
---|---|---|---|
content.id | int | My news id | The news id |
content.title | varchar | My news item | The news title |
content.type | varchar | article | The content type, ie article or webpage |
content.url | varchar | /blog/my-news-article | The url for the news article |
content.image | varchar | /images/blog_images/news-image.jpg | The image title |
content.name | varchar | The news name | The news name |
content.body | html | My news content in HTML etc.. | The news content in HTML |
content.author.name | varchar | John Doe | The name of the author |
content.date.created | varchar | Tue 11th June 2011, 13:45 | The date the article was created |
content.date.edited | varchar | Tue 11th June 2011, 13:45 | The date the article was edited |
Usage (List of articles)
If you want to simply display a list of news articles, you can do so as follows:-
{% elseif content.type == 'article' %}
<section class="section-tour" style="opacity: 0.8;background: #fff url('/media/icapp-1920.jpg') no-repeat 0 -1130px;">
<div class="container container-tour">
<div class="ic-headline ic-headline-customers-say">
<h1 style='color:#000'>
{{ content.title }}
{% if content.type == 'article' %}
<small><br>Written By: {{ content.author.name }} on {{ content.date.created|date("l jS M Y") }}</small>
{% endif %}
</h1>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class="divider-clear-10px"></div>
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<center><span class="text-sm">{{ random(500) }} Shares</span><div class="addthis_sharing_toolbox"></div></center>
<hr>
<div class="divider-clear-20px"></div>
{{ content.body|raw }}
<div class="divider-clear-30px"></div>
<hr>
<center><a href="/news" class="btn btn-primary btn-small" title="Go Back">< Go Back</a></center>
</div>
</div>
</div>
</section>
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4d911e6078fa72a8" async="async"></script>
{% else %}
{{ content.body|raw }}
{% endif %}
Comments
0 comments
Please sign in to leave a comment.