double-sorted headlines

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

Moderator: Spunkmeyer

double-sorted headlines

Postby InSAnE NiNjA » Tue Jul 19, 2005 6:59 pm

okay.. my friend has a site where they post items many times daily

football and non-football categories (not that that matters)

he wants the football headlines of the day to appear on top of the day, then the non-football items below

3 days but not the previous 3 days, the previous 3 days WITH posts.. this is an xms site so counting on news to not be built, is not good

my idea: build strings, and then count days
and dump items for each day through an inner template (at the start of the next day)

heres what i got
Code: Select all
<PerlCode>

$String{$Category} .= qq~<li><a href="$CustomField_URL" target="_blank">$Subject</a> $CustomField_Source</li>~;


if ($daily{$ProfileName}++ > 1 && ISNEWDAY_SUB_HERE) {

$OUTPUT .= qq~<ul><li>Football Related<ul>$String{'football'}</ul></li><li>Non Football<ul>$String{'nonfootball'}</ul></li></ul>~;

my $String;

if ($count{$ProfileName}++ >= 2) ENDLOOP;
}
</PerlCode>


i dont know the real ENDLOOP/ISNEWDAY_SUB_HERE command or the real $OUTPUT variable

i have to go out of town.. now.. could anyone correct errors and finish this for me?

this is the page this coranto script will eventually be used for...
http://ksufootball.com/hotlinks/
..nuttier then a squirrel turd..
User avatar
InSAnE NiNjA
 
Posts: 1213
Joined: Sat Jan 25, 2003 6:35 am

Re: double-sorted headlines

Postby Parahead » Tue Aug 02, 2005 9:34 am

InSAnE NiNjA wrote:i dont know the real ENDLOOP/ISNEWDAY_SUB_HERE command or the real $OUTPUT variable
Code: Select all
ENDLOOP: PROFLOOP
ISNEWDAY_SUB_HERE: isNewDate
$OUTPUT: $newshtml
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 freEkjokA » Wed Aug 03, 2005 6:25 pm

This is the code I'm using:

Code: Select all
<PerlCode>

$String{$Category} .= qq~<li><a href="$CustomField_Hotlinks_URL" target="_blank">$CustomField_Hotlinks_Link_Name</a> $CustomField_Hotlink_Source</li>~;


if ($daily{$ProfileName}++ > 1 && isNewDate) {

$newshtml .= qq~<ul><li>Football Related<ul>$String{'CustomField_Hotlinks_Football'}</ul></li><li>Non Football<ul>$String{'CustomField_Hotlinks_Other'}</ul></li></ul>~;

my $String;

if ($count{$ProfileName}++ >= 2) PROFLOOP;
}
</PerlCode>


And, I get this error when saving the style:

Error: That style is invalid and has a syntax error. Check, in particular, that all ifs are properly matched and ended. Perl reported the following error, which may or may not be helpful: syntax error at (eval 15) line 14, near ") PROFLOOP"
[/code]
freEkjokA
 
Posts: 7
Joined: Wed Aug 03, 2005 6:23 pm

Postby Parahead » Thu Aug 04, 2005 12:14 pm

freEkjokA wrote:And, I get this error when saving the style:

Code: Select all
Error: That style is invalid and has a syntax error. Check, in particular, that all ifs are properly matched and ended. Perl reported the following error, which may or may not be helpful: syntax error at (eval 15) line 14, near ") PROFLOOP"
Change the line:
Code: Select all
if ($count{$ProfileName}++ >= 2) PROFLOOP;
to this instead:
Code: Select all
next PROFLOOP if ($count{$ProfileName}++ > 1);
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 freEkjokA » Thu Aug 04, 2005 3:54 pm

Ok, this is the code I'm using now:

Code: Select all
<PerlCode>

$String{$CustomField_Hotlinks_Football} .= qq~<font id="text">→ <a href="$CustomField_Hotlinks_URL" target="_blank">$CustomField_Hotlinks_Link_Name</a> $CustomField_Hotlink_Source</font><br />~;
$String{$CustomField_Hotlinks_Other} .= qq~<font id="text">→ <a href="$CustomField_Hotlinks_URL" target="_blank">$CustomField_Hotlinks_Link_Name</a> $CustomField_Hotlink_Source</font><br />~;


if ($daily{$ProfileName}++ > 1 && isNewDate) {

$newshtml .= qq~<p align="left"><br /><font id="header"><b>$Date</b></font></p><p align="left"><font id="text"><b>Football Related</b><br />$String{$CustomField_Hotlinks_Football}</font></p><ul><p align="left"><font id="text"><b>Non Football</b><br />$String{$CustomField_Hotlinks_Other}</font></p></ul>~;

my $String;

next PROFLOOP if ($count{$ProfileName}++ > 2);
}
</PerlCode>


And this is what it prints on the web page:

Image

It just continues to print the most recently posted news item at the top of that category (Football Related/Non Football) or day's news.
freEkjokA
 
Posts: 7
Joined: Wed Aug 03, 2005 6:23 pm

Postby Parahead » Thu Aug 04, 2005 8:48 pm

freEkjokA wrote:Ok, this is the code I'm using now:

Code: Select all
<PerlCode>

$String{$CustomField_Hotlinks_Football} .= qq~<font id="text">→ <a href="$CustomField_Hotlinks_URL" target="_blank">$CustomField_Hotlinks_Link_Name</a> $CustomField_Hotlink_Source</font><br />~;
$String{$CustomField_Hotlinks_Other} .= qq~<font id="text">→ <a href="$CustomField_Hotlinks_URL" target="_blank">$CustomField_Hotlinks_Link_Name</a> $CustomField_Hotlink_Source</font><br />~;
Well, you have changed the original code to that above so? The original code used $Category instead of $CustomField_Hotlinks_Football and $CustomField_Hotlinks_Other, so I guess you have two categories named that, which you post news into? Change back the code to only one line that uses $Category instead...

The variable $Category contains the name of the category so that the links automatically will be placed in two different "folders". Then when you print out the links, use "CustomField_Hotlinks_Football" and "CustomField_Hotlinks_Other" instead of using a variablename (the $ sign)...
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 freEkjokA » Thu Aug 04, 2005 8:55 pm

Doing that,

Code: Select all
<PerlCode>

$String{$Category} .= qq~<li><a href="$CustomField_Hotlinks_URL" target="_blank">$CustomField_Hotlinks_Link_Name</a> $CustomField_Hotlink_Source</li>~;

if ($daily{$ProfileName}++ > 1 && isNewDate) {

$newshtml .= qq~<p align="left"><br /><font id="header"><b>$Date</b></font></p><p align="left"><font id="text"><b>Football Related</b><br />$String{$CustomField_Hotlinks_Football}</font></p><ul><p align="left"><font id="text"><b>Non Football</b><br />$String{$CustomField_Hotlinks_Other}</font></p></ul>~;

my $String;

next PROFLOOP if ($count{$ProfileName}++ > 2);
}
</PerlCode>


Gives me this:

Image
freEkjokA
 
Posts: 7
Joined: Wed Aug 03, 2005 6:23 pm

Postby freEkjokA » Thu Aug 04, 2005 9:00 pm

Nevermind that last post... didn't see that last part of your post. Will give that a try now.
freEkjokA
 
Posts: 7
Joined: Wed Aug 03, 2005 6:23 pm

Postby freEkjokA » Wed Dec 21, 2005 3:33 am

An error has occurred. The exact description of the error is:
Addon Maginot (cra_maginot.pl) caused an error. Disable the addon to prevent this error from recurring. Error: Label not found for "next PROFLOOP" at crcfg.dat line 350.


I get this error when using:

Code: Select all
<PerlCode>

$String{$Category} .= qq~<font id="text">? <a href="$CustomField_Hotlinks_URL" target="_blank">$CustomField_Hotlinks_Link_Name</a> $CustomField_Hotlink_Source</font><br />~;

if ($daily{$ProfileName}++ > 1 && isNewDate) {

$newshtml .= qq~<p align="left"><br /><font id="header"><b>$Date</b></font></p><p align="left"><font id="text"><b>Football Related</b><br />$String{$Hotlinks_football}</font></p><ul><p align="left"><font id="text"><b>Non Football</b><br />$String{$Hotlinks_other}</font></p></ul>~;

my $String;

next PROFLOOP if ($count{$ProfileName}++ > 2);
}
</PerlCode>


Help?[/code]
freEkjokA
 
Posts: 7
Joined: Wed Aug 03, 2005 6:23 pm

Postby bozoka45 » Wed Dec 21, 2005 7:21 pm

Did this just start happening? Did you upgrade maginot or Coranto? Did it work before (based upon your previous posts, it has worked before).
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby freEkjokA » Wed Dec 21, 2005 7:52 pm

bozoka45 wrote:Did this just start happening? Did you upgrade maginot or Coranto? Did it work before (based upon your previous posts, it has worked before).


I actually didn't need this setup until a couple of weeks ago so dropped working on it back when I originally posted this.

But everything in Coranto is the same now as it was originally -- no new addons or changes were made.

Does maginot work with categories?
freEkjokA
 
Posts: 7
Joined: Wed Aug 03, 2005 6:23 pm

Postby Parahead » Thu Dec 22, 2005 7:36 am

freEkjokA wrote:Does maginot work with categories?
Interesting conclusion, the errormessage says Label not found for "next PROFLOOP" and has nothing to do with categories... ;-)

As you can see from the example the PROFLOOP label is used in the code. Since we talked about headlines in the begining of this thread, that was a label that could be used to skip items from being used during the build process. However, if we do talk about a Maginot Profile which seems to be the case, this is not a label Maginot uses and thus it can't be used in the code.

So, is there a special need for you to use this in a Maginot Profile instead of in a normal profile? If so, what type of Maginot Profile are you using? I am having a little hard time getting my head arround what you really want the output to look like...
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 freEkjokA » Thu Dec 22, 2005 7:24 pm

Parahead wrote:
freEkjokA wrote:Does maginot work with categories?
Interesting conclusion, the errormessage says Label not found for "next PROFLOOP" and has nothing to do with categories... ;-)


I was referring to this:

Addon Maginot (cra_maginot.pl) caused an error.


Didn't get the error until I turned categories on.

Anyways, I've started over entirely and this is how things are setup...

My style template:

Code: Select all
<PerlCode>

$String{$Category} .= qq~<font id="text">? <a href="$CustomField_Hotlinks_URL" target="_blank">$CustomField_Hotlinks_Link_Name</a> $CustomField_Hotlink_Source</font><br />~;

if ($daily{$ProfileName}++ > 1 && isNewDate) {

$newshtml .= qq~<p align="left"><br /><font id="header"><b>$Date</b></font></p><p align="left"><font id="text"><b>Football Related</b><br />$String{$Hotlinks_football}</font></p><ul><p align="left"><font id="text"><b>Non Football</b><br />$String{$Hotlinks_other}</font></p></ul>~;

my $String;

next PROFLOOP if ($count{$ProfileName}++ > 1);
}
</PerlCode>


I have an XmultiSubmit profile setup. Using a standard news profile. Everything "works". Except, something with that style's code is incorrect, because it won't write anything to the .txt news file when I submit a news story. But when I change the news style to:

Code: Select all
<PerlCode>
if ($counter{$ProfileName}++ < 50) {
</PerlCode>

<If: Sub: isNewDate><p align="left"><br /><font id="header"><b><Field: Date></b></font></p></If>

<font id="text">→ <a href="http://<Field: CustomField_Hotlinks_URL>" target="_blank"><Snip 50: Field: CustomField_Hotlinks_Link_Name></a></font> <font id="newsextra"><i><Field: CustomField_Hotlink_Source></i></font><If: Field: CustomField_Hotlinks_Subscription_Required>&nbsp;<img src="/img/misc/subscription_required.jpg" title="Subscription Required"></If><If: Field: CustomField_Hotlinks_Subscription_Fee>&nbsp;<img src="/img/misc/subscription_fee.jpg" title="Subscription Fee"></If><br /><If: Field: CustomField_Hotlink_Extra><font id="text">&nbsp;&nbsp;&nbsp;&nbsp;<b><Field: CustomField_Hotlink_Extra></b></font><br /></If>

</If>


Everything works as normal... other than I don't have sorted categories and it's using the same style I'm currently using with one list of links per day. I want to have a list of links with Football links (to various news stories on the internet) and the under the football links Other news with other top news stories from around the sports world. So it would look something like this:

Code: Select all
December 22, 2005

Football news
A football link here Source
A football link here Source
A football link here Source
A football link here Source

        Other news
        A football link here Source
        A football link here Source


I hope this makes sense. :D
freEkjokA
 
Posts: 7
Joined: Wed Aug 03, 2005 6:23 pm

Postby Parahead » Fri Dec 23, 2005 8:01 am

freEkjokA wrote:So it would look something like this:
Code: Select all
December 22, 2005

Football news
A football link here Source
A football link here Source
A football link here Source
A football link here Source

        Other news
        A football link here Source
        A football link here Source


I hope this makes sense. :D
Hmmm... There are several ways of solving this, no one is straight forward though... One would be to use the Sort Orders addon and sort the newsitems based on two fields, the first being the posting date (and only date, not date+time), the second being the category (or some other field). You need make sure that the second field you sort by makes the Fotboll newsitems being sorted at top. Then you can use isNewDate as you currently do to present the first headline and then some other code (similar to the one in the IsNewValue addon) to check if there is a change in the second field and if it isn't a Fotboll news then present the second headline.

Like I said, it isn't straight forward and the solution above would require some time (which I don't have) and testing from my part to work, so just take the above as a hint for you to try out yourself if you have the knowledge... Your main concern is to get the newsitems sorted correctly, then you can apply the two headlines and news counting limitations.

Maybe someone else has some other good suggestion?
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


Return to Customization

Who is online

Users browsing this forum: Exabot [Bot] and 1 guest

cron