How do you set a MINIMUM number in profiles?

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

Moderator: Spunkmeyer

How do you set a MINIMUM number in profiles?

Postby Variant Ground » Wed Jun 22, 2005 7:23 pm

Hey all,

I wanted to know if there's anyway to set a minimum items to be displayed by a profile? Ideally, I'd like to show only 1 day of news, but if there's only 1 or 2 things updated that day it doesn't look very good. So, I need a way to tell the profile to show either 1 day of news (all of it) or a minimum of 5 if there's very little news that day.

I hope that makes sense, and thanks for any help.
User avatar
Variant Ground
 
Posts: 4
Joined: Sat Apr 30, 2005 6:01 am
Location: Second star to the left.. yes.. left.

Re: How do you set a MINIMUM number in profiles?

Postby Parahead » Thu Jun 23, 2005 4:55 am

Variant Ground wrote:I wanted to know if there's anyway to set a minimum items to be displayed by a profile? Ideally, I'd like to show only 1 day of news, but if there's only 1 or 2 things updated that day it doesn't look very good. So, I need a way to tell the profile to show either 1 day of news (all of it) or a minimum of 5 if there's very little news that day.
Have you checked out the Profile settings page? There is a setting to specify the amount of newsitem (by days and number) to include in that profile. It does not contain any option to set the values as "if not that, then this instead" though... What I would do is specify 5 as the number of items to include and leave it by that.
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 bozoka45 » Fri Jun 24, 2005 1:52 am

If need be you could probably use some PerlCode to do exactly what you want.
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby Variant Ground » Fri Jun 24, 2005 2:35 am

You wouldn't know off-hand what that PerlCode would be, would you? :D
Into FFXI?
Well check out, Battle for the Invite!
Comments and Crits are welcome.
User avatar
Variant Ground
 
Posts: 4
Joined: Sat Apr 30, 2005 6:01 am
Location: Second star to the left.. yes.. left.

Postby InSAnE NiNjA » Sun Jun 26, 2005 10:18 am

Variant Ground wrote:You wouldn't know off-hand what that PerlCode would be, would you? :D


have you actually tried editing profiles to set ammount of items displayed.. before you get into enhanced profile hacking? because thats only needed once you get into complex addons that overwrite or mess with normal coranto operations
..nuttier then a squirrel turd..
User avatar
InSAnE NiNjA
 
Posts: 1213
Joined: Sat Jan 25, 2003 6:35 am

Postby Lumberjack » Tue Jun 28, 2005 3:26 pm

Probably something like:
Code: Select all
<PerlCode>
$Custom_counter++;
if (isNewDay and $Custom_counter > 5) {
   [INSERT CODE FOR ENDING BUILDING PROCESS]
}
</PerlCode>

I just realised I don't know how to end the build process for a profile, so someone else will have to suggest that part. This code is by no means tested of course, it is just a foundation for something that might work.
Lumberjack
 
Posts: 555
Joined: Wed Jan 10, 2007 7:22 pm
Location: Oxford, UK

Postby Parahead » Tue Jun 28, 2005 5:32 pm

Lumberjack wrote:Probably something like:
Code: Select all
<PerlCode>
$Custom_counter++;
if (isNewDay and $Custom_counter > 5) {
   [INSERT CODE FOR ENDING BUILDING PROCESS]
}
</PerlCode>

I just realised I don't know how to end the build process for a profile, so someone else will have to suggest that part. This code is by no means tested of course, it is just a foundation for something that might work.
I took the liberty to update your code a little, so that it might acually work... ;-)

Code: Select all
<PerlCode>
$FirstDay{$ProfileName} = "$Year$TwoDigitMonth$TwoDigitDay" unless $FirstDay{$ProfileName};
$CustomCounter{$ProfileName}++;
if ( ($FirstDay{$ProfileName} ne "$Year$TwoDigitMonth$TwoDigitDay") and ($CustomCounter{$ProfileName} > 5) ) {
 last PROFLOOP;
}
</PerlCode>
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 Lumberjack » Wed Jun 29, 2005 1:53 am

Thanks a lot, I appreciate that... I'll try to remember that PROFLOOP marker too, might come in handy. It's an interesting approach to doing isNewDay though, I don't really use that sub, I guess it doesn't work like I thought?
Lumberjack
 
Posts: 555
Joined: Wed Jan 10, 2007 7:22 pm
Location: Oxford, UK

Postby Parahead » Wed Jun 29, 2005 5:44 am

LJ wrote:I'll try to remember that PROFLOOP marker too, might come in handy.
The PROFLOOP ends the current profile, so the newsitem will be built in the next profile if it is placed in any. There are another marker NCLOOP which you can use if you need to filter a newsitem all together sometime (in an addon for example). Check out the BuildNews sub in crcore.pl for more details...

Lumberjack wrote:It's an interesting approach to doing isNewDay though, I don't really use that sub, I guess it doesn't work like I thought?
Sorry, I should have mentioned why I did it that way instead of using the isNewDay sub. The thing is that isNewDay only triggers (returns true) for the *first* change between dates. That is so you will be able to present a header or something for the "group" of news that day. Your code relied on it returning true AND the counter being above 5, which would have only ended the building of the profile during a switch of day. The code I use to check for a new day returns true as soon as it is a new day and then returns true every time. Hope that made any sense at all? ;-)
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 Lumberjack » Wed Jun 29, 2005 1:32 pm

Check out the BuildNews sub in crcore.pl for more details...

Yes, will do.
Sorry, I should have mentioned why I did it that way instead of using the isNewDay sub. The thing is that isNewDay only triggers (returns true) for the *first* change between dates. That is so you will be able to present a header or something for the "group" of news that day. Your code relied on it returning true AND the counter being above 5, which would have only ended the building of the profile during a switch of day. The code I use to check for a new day returns true as soon as it is a new day and then returns true every time. Hope that made any sense at all?

Ah yes, I was concerned about that when I made my suggestion, I kind of figured it would work like that... but still, making the suggestion helps as often other people will modify the code so it works better (like a kickstart to the solution..)
EDIT: its a very cool way you've done it actually, good thinking.
Lumberjack
 
Posts: 555
Joined: Wed Jan 10, 2007 7:22 pm
Location: Oxford, UK

Postby Parahead » Wed Jun 29, 2005 7:25 pm

Lumberjack wrote:EDIT: its a very cool way you've done it actually, good thinking.
It is your kickstart codebase and the 'core' is almost the same, I just improved it slightly, so no need to flatter... ;-)
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: No registered users and 1 guest

cron