Multiple authors / 1 News Item

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

Moderator: Spunkmeyer

Multiple authors / 1 News Item

Postby Egon » Fri Nov 07, 2003 6:06 pm

Here is what I am trying to accomplish...

I have an audio links section on my site (http://www.masscore.com/news/Audio.php). I would like to add a reviews for each track. Here is where I get stuck, I would like each user to be able to review the tracks.

For example:

1. mp3 link 1
--author 1 review
--author 2 review
--author 3 review

2. mp3 link 2
--author 1 review
--author 2 review

The only way I could think of doing it would be to create CustomFields for every author but that would make a very ugly submit news page if I had a lot of authors.

Any help???
Egon
 
Posts: 14
Joined: Tue Sep 24, 2002 2:17 pm

Postby LoneOwl » Fri Nov 07, 2003 6:18 pm

Hmmm... I'd say it'd be best to have an addon. Otherwise it would require having a new profile for each one, and that would become tedious.

Currently, it's not easy.
User avatar
LoneOwl
 
Posts: 1465
Joined: Sun Mar 10, 2002 2:57 am
Location: That one place, you know?

Postby Egon » Tue Nov 11, 2003 1:40 pm

Damn, that is what I feared.

Thank you for the help, I now must dive into my perl book o' tricks and see if I can come up with anything. Unless someone wants to do it for me. :lol:

Thanks again for the speedy response.
Egon
 
Posts: 14
Joined: Tue Sep 24, 2002 2:17 pm

Postby Parahead » Tue Nov 11, 2003 2:13 pm

Hmmm... Wouldn´t this be something that you could use the iSay-addon to accomplish?
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 kriko » Wed Nov 12, 2003 7:15 pm

Parahead wrote:Hmmm... Wouldn´t this be something that you could use the iSay-addon to accomplish?

isn't that addon for comments and stuff?
Kristjan aka. kriko
now a wireless expert
User avatar
kriko
 
Posts: 3328
Joined: Sat Feb 24, 2007 8:13 pm

Postby Parahead » Wed Nov 12, 2003 7:29 pm

kriko wrote:
Parahead wrote:Hmmm... Wouldn´t this be something that you could use the iSay-addon to accomplish?

isn't that addon for comments and stuff?

Yes, comments on an article (or a MP3-link in this case) which could be seen as a review... Sort of... Didn´t say it was *the* solution, just a suggestion for him to look deeper into... :-)
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 kriko » Wed Nov 12, 2003 8:10 pm

Yep. That could work, though... As for a solution, I was thinking,

1. Profile
2. Sorting (using modified version by Parahead) by 2 fields: 1- MP3 field, 2- author
3. Using a sub, similar to the isNew.... implemented by Lawrence in the latest builds.

that sub can be just copy pasted from the core, insterted to cruser.pl and then modified to match the right field.
Kristjan aka. kriko
now a wireless expert
User avatar
kriko
 
Posts: 3328
Joined: Sat Feb 24, 2007 8:13 pm

Postby Egon » Fri Nov 14, 2003 7:57 pm

Wow, thanks for the replies.

I was trying to stay away from ISAY due to the additional login process and quite frankly it seemed too bulky and too many options for what I was trying. Also I read there were some problems with Maginot.

Kriko,

Could you explain your solution a little more in detail.

Thanks again for everyone's help.
Egon
 
Posts: 14
Joined: Tue Sep 24, 2002 2:17 pm

Postby Parahead » Fri Nov 14, 2003 9:12 pm

I thought kriko´s solution to be interesting and since it included a new sub I couldn´t resist to but in.... To start things off, the method kriko has "tweeked" when suggesting the isNewDate-sub can be found at the end of this document. Maybe it also helps you to understand what happens below...

1) Create a profile

2) Edit it to sort by two fields, the 1st should be the Mp3-field, the 2nd should be the name of the author. (You need the sortorders-addon)

3) Use the sub below, which has *not* been tested, but should work. Place this in your file cruser.pl, below the "INSERT CUSTOM SUBROUTINES HERE"-lines

Code: Select all
my (%NewFieldInfo, $lastAnswerField, $lastIDField, $lastProfField, $lastFileField);     
sub isNewFieldValue {
   my $isNewField;
   if ($newsid eq $lastIDField && $ProfileName eq $lastProfField && $FileName eq $lastFileField) {
      return $lastAnswerField;
   }
   my $fieldValue = $CustomField_XXXXXXXXXXXXXXXXXXXX;
   if (!$NewFieldInfo{"$ProfileName--$FileName"} || $NewFieldInfo{"$ProfileName--$FileName"} ne $fieldValue) { # First new fieldvalue
      $lastIDField = $newsid;
      $lastAnswerField = 1;
      $NewFieldInfo{"$ProfileName--$FileName"} = $fieldValue;
      return 1;
   }
   else { # Next same fieldvalue
      return 0;
   }
}

Please be careful about the linebreaks, the forum mess things up! Also note that you must change the XXXXXXXXXXXXX above to the name of your MP3-CustomField...

4) Then in the style, use something like this:
Code: Select all
<If: Sub: isNewFieldValue>
Print out Mp3-information here
</If>


Give it a try, come back here if it doesn´t do what you want, OK...
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 Egon » Fri Nov 14, 2003 10:35 pm

I tried it out but I'm not sure if I configured it correctly.

For the CustomField, I currently use 3 different types (MP3name, MP3url, MP3review). I guessed that you meant the CustomField was for the MP3review.

Just to make sure we are all on the same page here is what I think could happen in a 'perfect world.' Ideally, I would like when a user submits a MP3 for a field entitled (username)_review (i.e. Egon_review) to appear. Then for another user to be able to login -> modify the news and have a new field call (his_username)_review. Again that is a perfect world.

I originally thought, something along the lines of if review_field1 is filled in, then when someone is modifying, review_field2 appears and so on and so on.
Then I realized this is a pretty big load for a beginner like me.

Any help is greatly appreciated.

Thanks again
Egon
 
Posts: 14
Joined: Tue Sep 24, 2002 2:17 pm

Postby Parahead » Sat Nov 15, 2003 2:55 pm

Egon wrote:For the CustomField, I currently use 3 different types (MP3name, MP3url, MP3review). I guessed that you meant the CustomField was for the MP3review.

No, in this case I would say that it is the MP3url *or* MP3name that would be of interest to sort by and using the isNewFieldValue-sub for...

In your style:
Code: Select all
<If: Sub: isNewFieldValue>
Print out Mp3-information and then review information, maybe placed in two different <TR></TR>-rows?
<If: Else>
Print out the review information
</If>


I just realized another thing that may be confusing this conversation... You can *not* have one newsitem and several publisher, you will have several newsitem, where you specify the exact same MP3name and MP3url for every review... I am in a bit of hurry right now, so if this doesn´t make sence, give me a howl and I explain better later, OK... :-)
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 » Wed Dec 01, 2004 10:06 am

Parahead wrote:I thought kriko´s solution to be interesting and since it included a new sub I couldn´t resist to but in.... To start things off, the method kriko has "tweeked" when suggesting the isNewDate-sub can be found at the end of this document. Maybe it also helps you to understand what happens below...

1) Create a profile

2) Edit it to sort by two fields, the 1st should be the Mp3-field, the 2nd should be the name of the author. (You need the sortorders-addon)

3) Use the sub below, which has *not* been tested, but should work. Place this in your file cruser.pl, below the "INSERT CUSTOM SUBROUTINES HERE"-lines

Code: Select all
my (%NewFieldInfo, $lastAnswerField, $lastIDField, $lastProfField, $lastFileField);     
sub isNewFieldValue {
   my $isNewField;
   if ($newsid eq $lastIDField && $ProfileName eq $lastProfField && $FileName eq $lastFileField) {
      return $lastAnswerField;
   }
   my $fieldValue = $CustomField_XXXXXXXXXXXXXXXXXXXX;
   if (!$NewFieldInfo{"$ProfileName--$FileName"} || $NewFieldInfo{"$ProfileName--$FileName"} ne $fieldValue) { # First new fieldvalue
      $lastIDField = $newsid;
      $lastAnswerField = 1;
      $NewFieldInfo{"$ProfileName--$FileName"} = $fieldValue;
      return 1;
   }
   else { # Next same fieldvalue
      return 0;
   }
}

Please be careful about the linebreaks, the forum mess things up! Also note that you must change the XXXXXXXXXXXXX above to the name of your MP3-CustomField...

4) Then in the style, use something like this:
Code: Select all
<If: Sub: isNewFieldValue>
Print out Mp3-information here
</If>


Give it a try, come back here if it doesn´t do what you want, OK...


This was very helpful. I think its a good canidate for a Q&A or, to even put into the next release somehow? Cheers again to Parahead. :cheers:
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby Parahead » Wed Dec 01, 2004 7:01 pm

bozoka45 wrote:This was very helpful. I think its a good canidate for a Q&A or, to even put into the next release somehow?
This is not a bad idea. To be truly flexible it would be required to be able to pass along one or many fields to a sub though (so the XXXXXXXX part in isNewFieldValue could be removed). There has been a deeper discussion of this type of style tags before and I have also done some implementations of this in an addon, maybe I could send this over to cerberos76 if there is an interest?

bozoka45 wrote:Cheers again to Parahead. :cheers:
:cheers:
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 » Wed Dec 01, 2004 9:14 pm

Parahead wrote:
bozoka45 wrote:This was very helpful. I think its a good canidate for a Q&A or, to even put into the next release somehow?
This is not a bad idea. To be truly flexible it would be required to be able to pass along one or many fields to a sub though (so the XXXXXXXX part in isNewFieldValue could be removed). There has been a deeper discussion of this type of style tags before and I have also done some implementations of this in an addon, maybe I could send this over to cerberos76 if there is an interest?

bozoka45 wrote:Cheers again to Parahead. :cheers:
:cheers:


I had to use it for two fields. I probably could have done it in a more effective manner, but I just copied and pasted, renamed the sub, and then changed the CustomField.

I guess I could do:

Code: Select all
<PerlCode>
if (&isNewFieldValue($CustomFieldxx)) {
blah
}
</PerlCode>


After editing the sub a little, something along those lines should work, would it not?
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby Parahead » Thu Dec 02, 2004 7:18 am

bozoka45 wrote:I guess I could do:

Code: Select all
<PerlCode>
if (&isNewFieldValue($CustomFieldxx)) {
blah
}
</PerlCode>

After editing the sub a little, something along those lines should work, would it not?
Yes, that should work.
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 0 guests

cron