Help with my first theme...

Help with my first theme..., a forum discussion on Jojo CMS. Join us for more discussions on Help with my first theme... on our Themes Support forum.

Back to Forum Index : Back to Themes Support   RSS
cgiddings cgiddings

8 Apr 2009
Posts: 2

I'm not sure if this is a Smarty issue or what...

I need the first page of my site to list the full text of the latest article and summaries for a limited number of prior articles (3-5).

Does anyone have suggestions for how to attack this particular issue?

Thanks a million!
Awesomeness for the heck of it...
tom

Developer

tom

8 Apr 2009
Posts: 379

your template should have something like this in it (the number of articles displayed is controlled through options):

{if $articles}
<div id='news' class="sidebarbox">
<h2>News</h2>

{foreach from=$articles key=key item=article}
{if $article.ar_image}<img src="images/v7000/articles/{$article.ar_image}" alt = "{$article.title}" class="right-image" style="clear: right"/>{/if}
<h3><a href='{$article.url}'>{$article.title}</a></h3>
<p class='news-content'>
{$article.bodyplain|truncate:156:"..."}
<a class='links' href='{$article.url}' title="{$article.title}">&gt;&nbsp;Read&nbsp;more</a>
</p>
{/foreach}
<p class="links">&gt; <a href='{$SITEURL}/{$articleshome}/'>See all stories</a></p>
</div>
{/if}

the trick is to use the $key to control the truncate - so instead of :

<p class='news-content'>
{$article.bodyplain|truncate:156:"..."}
<a class='links' href='{$article.url}' title="{$article.title}">&gt;&nbsp;Read&nbsp;more</a>
</p>

use:

{if $key==0}
{$article.ar_body}
{else}
<p class='news-content'>
{$article.bodyplain|truncate:156:"..."}
<a class='links' href='{$article.url}' title="{$article.title}">&gt;&nbsp;Read&nbsp;more</a>
</p>
{/if}

cgiddings cgiddings

8 Apr 2009
Posts: 2

Tom,

Thanks, that's lickity split!

Can I put that code in a content page created within JoJo? I'm hoping for this to be the front page of the site...

Thanks!
Awesomeness for the heck of it...
tom

Developer

tom

8 Apr 2009
Posts: 379

No.
You'll need to add that code to the templates/template.tpl file in your theme folder

if you want to limit it to displaying only on the homepage you can wrap the whole thing in another {if}{/if) set in theme template file:

{if $pageid==1}
( the article stuff)
{/if}
Back to Forum Index : Back to Themes Support   RSS
You must be logged in to post a reply



You need to Register or Log In before posting on these forums.