One thumbnail to go along with headlines

Discuss news styles, css code, and other Coranto customizations in here...the possibilities are endless, so have at it!

Moderator: Spunkmeyer

One thumbnail to go along with headlines

Postby thepan » Fri Oct 06, 2006 3:55 pm


I'd like to set up the headlines section sort of like the Foxsports section of I currently have five headlines showing on the main page. I was using the Multipart add-on to submit a picture with the news story. The headlines had a picture to the right of them. However, I just want the most recent headline to have a corresponding picture. I usually have a knack for taking the long-winded route until I find something that eventually works. I was wondering if someone already knew of a more efficient way to get this to work, or if you could point me in the right direction. I did seach, but I couldn't find anything relevant.

Thanks for your time.

PERL: 5.8.6
Coranto: 1.24

Multipart :1.59
NewsCounter: 0.4 (disabled)
Posts: 2
Joined: Thu Oct 05, 2006 8:02 pm

Postby Dale Ray » Fri Oct 06, 2006 6:10 pm

What you want to do is only display the headline on the first item. Put this perl code at the top of your headline style:
Code: Select all
$showPic = 0;
if ( not $firstItem{$ProfileName}  ) {
$firstItem{$ProfileName}  = 1;
$showPic = 1;

Then where you want the picture to be displayed use this:
Code: Select all
<If: Field: showPic><img src="<Field: CustomField_yourPicField>"></If>

You will have to include any html code you want also.

This perl code will set $showPic to 1 only on the first pass item for each profile that uses this style. The second if statement tests the value of $showPic and only includes you picture for the first item.

See Implementating and Using Item Counters in a Coranto Style for more about using counters.
Dale Ray
User avatar
Dale Ray
Posts: 1004
Joined: Sun Jan 19, 2003 6:02 pm
Location: NW Indiana

Postby thepan » Fri Oct 06, 2006 6:54 pm

Thank you very much for the help. I added an extra If statement that shows a default picture if nothing was upload with the last entry. Thanks again, it's much appreciated!!
Posts: 2
Joined: Thu Oct 05, 2006 8:02 pm

Return to Customization

Who is online

Users browsing this forum: No registered users and 1 guest