Custom Perl Help

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

Moderator: Spunkmeyer

Custom Perl Help

Postby Stash » Sun Feb 19, 2006 4:27 pm

I Currently a custom fields called CustomField_Month, posters enter 1-12 to indicate the month is there any way of putting perl in the style so it would change 1=Jan 2=Feb etc.

I need to keep it as a number when posted for sorting purposes.

I presume it would be something like this but not sure what to use:

<PerlCode>
$CategoryName = '1:' if($Category eq 'Jan');
</PerlCode>

Thanks in Advance
Stash
 
Posts: 8
Joined: Sun Feb 19, 2006 4:20 pm

Postby Stash » Sun Feb 19, 2006 8:15 pm

i figured it out so thought would post it:

<PerlCode>
$CategoryMonth = 'January' if($CustomField_ShowMonth eq '01');
$CategoryMonth = 'February' if($CustomField_ShowMonth eq '02');
$CategoryMonth = 'March' if($CustomField_ShowMonth eq '03');
$CategoryMonth = 'April' if($CustomField_ShowMonth eq '04');
$CategoryMonth = 'May' if($CustomField_ShowMonth eq '05');
$CategoryMonth = 'June' if($CustomField_ShowMonth eq '06');
$CategoryMonth = 'July' if($CustomField_ShowMonth eq '07');
$CategoryMonth = 'August' if($CustomField_ShowMonth eq '08');
$CategoryMonth = 'September' if($CustomField_ShowMonth eq '09');
$CategoryMonth = 'October' if($CustomField_ShowMonth eq '10');
$CategoryMonth = 'November' if($CustomField_ShowMonth eq '11');
$CategoryMonth = 'December' if($CustomField_ShowMonth eq '12');
</PerlCode>
Stash
 
Posts: 8
Joined: Sun Feb 19, 2006 4:20 pm

Re: Custom Perl Help

Postby Parahead » Sun Feb 19, 2006 8:20 pm

Code: Select all
<PerlCode>
$MonthName = $Abbrev_Months[$CustomField_Month-1];
</PerlCode>
<Field: MonthName>
@Abbrev_Months is an array defined and used inside Coranto, but you can take advantage of it too...

[EDIT]
Just saw your post, I was posting just the same time... You use two digits to represent month, so the above doesn't really work then.
[/EDIT]
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby Stash » Sun Feb 19, 2006 8:41 pm

Thanks parahead i knew there would be an easier way just wasnt sure suprised myself i even got it working :)
Stash
 
Posts: 8
Joined: Sun Feb 19, 2006 4:20 pm


Return to Customization

Who is online

Users browsing this forum: Majestic-12 [Bot] and 3 guests

cron