multiple entries in one field?

Is Coranto not working properly for you? Here's where to ask for support help; for best results, follow these steps:
  • - Check your core/addon documentation for possible solutions
  • - Search these forums for similar problems that have already been solved
  • - If you're still stumped, check out THIS TOPIC, and post your question in this forum!!

Moderators: Spunkmeyer, Dale Ray, SrNupsen, Bluetooth, Jackanape

multiple entries in one field?

Postby amseek » Fri Jan 24, 2003 9:30 pm

hey

I'm trying to set up a post where my users would be entering in track titles for demo tapes of theirs. The final output to html for this would be in an ordered list <ol>, <li>, <li>, etc.

Is there a way to enter multiple data into one field and seperate that data with pipes ( | ) so that each individual data entry can be configured to plug into an ordered list

ie:

<ol>
<li><Field: CustomField_trackTitle></li>

</ol>


--so that is a user plugs in title01 | title02 | title03
it would output as:

1) title01
2) title02
3) title03


--I hope this makes sense...


the only other way I can think of is to set up the default text in the entry field with the html on it and tell my users to just replace the title fields with their titles like this:

<ol>
<li>track one title</li>
<li>track two title</li>
<li>track three title</li>
<li>track four title</li>
<li>track five title</li>
</ol>

--this would be doable but would be a big mess, so if there's another way, that would be way cool

thanks for all the help
-art
amseek
 
Posts: 37
Joined: Sun Jan 12, 2003 2:49 am
Location: Santa Cruz, CA

Postby ginakra » Fri Jan 24, 2003 9:49 pm

Well, you could put custom fields into your submit page. Try going into Administration->Edit News Fields. Go down the page to "Create New News Field ".

In the box, for example, put Track1, make display "Track 1", Field Type "Single Line Textbox".

Repeat this with "Track2", "Track3", etc. Until you get all the tracks you need.

Then, in your template, put:
<ol>
<li><Field: CustomField_Track1></li>
<li><Field: CustomField_Track2></li>
<li><Field: CustomField_Track3></li>
<li><Field: CustomField_Track4></li>
</ol>

That's the only way I know how, otherwise one of the programmers or someone who has more experience than me with Coranto will need to help :)
ginakra
 
Posts: 71
Joined: Mon Oct 28, 2002 3:17 pm

Postby amseek » Fri Jan 24, 2003 11:16 pm

yeah..

I know that would work too... just wanted to avoid having a huge input screen

I'm going to keep looking for something that might work....I havent' tried out multisubmit yet, I have no idea yet what it does, but no worries...eventually everything has a way of getting worked out
amseek
 
Posts: 37
Joined: Sun Jan 12, 2003 2:49 am
Location: Santa Cruz, CA

Postby ginakra » Sat Jan 25, 2003 12:41 am

I *think* the only other way to do what you're trying to do is hard-code it into Coranto.

Multisubmit will allow you to have multiple submit pages :) Which is good if you have a couple different categories (another add-on) which does not need the same custom fields to fill in.
ginakra
 
Posts: 71
Joined: Mon Oct 28, 2002 3:17 pm

Postby plushpuffin » Sat Jan 25, 2003 12:52 am

let them enter it with semicolons instead of pipes (easier to read) and then put this Perl code into your style:

<PerlCode>
$CustomField_MonkeyButtocks =~ s~\A[\;\s]*~~;
$CustomField_MonkeyButtocks =~ s~[\;\s]*\Z~~;
$CustomField_MonkeyButtocks =~ s~[;\s]*;~\;~g;
my @somethings = split( /\;/, $CustomField_MonkeyButtocks );
foreach $_ (@somethings) {
$newshtml .= qq~<li>$_</li>~;
}
</PerlCode>

that should work, although I haven't tested it.
I LIKE PIE
User avatar
plushpuffin
 
Posts: 411
Joined: Tue Mar 12, 2002 1:28 pm
Location: Buffalo, NY

Postby ginakra » Sat Jan 25, 2003 12:55 am

Heh. I must say I would have never come up with that. :dizzy:
ginakra
 
Posts: 71
Joined: Mon Oct 28, 2002 3:17 pm

Postby l0rdphi1 » Sat Jan 25, 2003 1:07 am

Just FYI - there's no point in placing her first two lines of regex if your staff know what they're doing.

No hard feelings plush, please ^_^
Last edited by l0rdphi1 on Sat Jan 25, 2003 1:11 am, edited 2 times in total.
User avatar
l0rdphi1
 
Posts: 3590
Joined: Sat Mar 09, 2002 10:03 pm
Location: Pennsylvania, United States of America

Postby plushpuffin » Sat Jan 25, 2003 1:09 am

I prefer to play it safe and assume ( $end_user == STUPID ) :lol:
I LIKE PIE
User avatar
plushpuffin
 
Posts: 411
Joined: Tue Mar 12, 2002 1:28 pm
Location: Buffalo, NY

Postby l0rdphi1 » Sat Jan 25, 2003 1:11 am

heh.. i'd also write it:
Code: Select all
<PerlCode>$newshtml .= join '', map { "<li>$_</li>" } split /\;/, $CustomField_MonkeyButtocks;</PerlCode>


:p
User avatar
l0rdphi1
 
Posts: 3590
Joined: Sat Mar 09, 2002 10:03 pm
Location: Pennsylvania, United States of America

yeeha!

Postby amseek » Sat Jan 25, 2003 3:37 am

hey Plushpuffin

it works wonderfully :D

okay, so now the cruncher:

within these lists, there are four seperate input fields to be put into each <li> </li>
1) Track authors
2)Track titles
3)Track subtitles
4)track record label

formatted as such:

1) Track Author 1 'Track title 1' Track subtitle 1 (Track record label 1)
1) Track Author 2 'Track title 2' Track subtitle 2 (Track record label 2)
1) Track Author 3 'Track title 3' Track subtitle 3 (Track record label 3)
1) Track Author 4 'Track title 4' Track subtitle 4 (Track record label 4)


the actual finished page should look like this:

1) PROTOTYPE 'La Caldera' Thomas Penton Remix (Tune Inn)
2) LAYO & BUSHWACKA! 'Shining Through' Album Sampler Part 1 (XL Recordings)
3) ROUTE 66 'Disco Thump' Broke Down EP (Nightshift)
4) DIZZY & JADO 'Shake It Fast' Original Mix (Doubledown)
5) MACELO CASTELLI 'Jungle Man' (Low Pressings)
6) ONIONZ & MASTER D 'Can't Turn to Momma' The Fading Memories EP (Doubledown)
7) HIPP-E 'Foolish Ways' Original (Doubledown)
8) AUGUST 'Tongue Tied (In the Congo)' Dark Tongues (Thunk)
9)SNEAKER PIMPS 'Bloodsport' Dylan Ryhmes Remix (10 Kilo)

so far with the code you gave me, I was able to out put this:

1) TEST ONE
2) TEST TWO
3) TEST THREE
4) TEST FOUR
5) TEST FIVE
--etc.--

This is utilizing only the first input field (<Field: CustomField_trackauthor>)

your code:

<ol>
<PerlCode>
$CustomField_trackauthor =~ s~\A[\;\s]*~~;
$CustomField_trackauthor =~ s~[\;\s]*\Z~~;
$CustomField_trackauthor =~ s~[;\s]*;~\;~g;
my @somethings = split( /\;/, $CustomField_trackauthor );
foreach $_ (@somethings) {
$newshtml .= qq~<li>$_</li>~;
}
</PerlCode>
</ol>

so basically I can see that the $_ stands for the input variable which equals @somethings, but I'm wondering if it's possible to add in the other three input fields withing that configuration

something like this?:

<ol>
<PerlCode>
$CustomField_trackauthor =~ s~\A[\;\s]*~~;
$CustomField_trackauthor =~ s~[\;\s]*\Z~~;
$CustomField_trackauthor =~ s~[;\s]*;~\;~g;
my @somethings = split( /\;/, $CustomField_trackauthor );

$CustomField_tracktitle =~ s~\A[\;\s]*~~;
$CustomField_tracktitle =~ s~[\;\s]*\Z~~;
$CustomField_tracktitle =~ s~[;\s]*;~\;~g;

$CustomField_tracksubtitle =~ s~\A[\;\s]*~~;
$CustomField_tracksubtitle =~ s~[\;\s]*\Z~~;
$CustomField_tracksubtitle =~ s~[;\s]*;~\;~g;

$CustomField_tracklabel =~ s~\A[\;\s]*~~;
$CustomField_tracklabel =~ s~[\;\s]*\Z~~;
$CustomField_tracklabel =~ s~[;\s]*;~\;~g;
foreach $_ (@somethings) {
$newshtml .= qq~<li>$_</li>~;
}
</PerlCode>
</ol>

see, I'm thinking I need to define each of the different fields but I get stuck on how to combine each of these CustomFields into the equation:

foreach $_ (@somethings) {
$newshtml .= qq~<li>$_</li>~;
}

where the
$newshtml .= qq~<li>$_</li>~;
would look more like this:

$newshtml .= qq~<li>$_ &'<CustomField_tracktitle>' &<CustomField_tracksubtitle> &(<CustomField_tracklabel>)</li>~;


?????????? :D
amseek
 
Posts: 37
Joined: Sun Jan 12, 2003 2:49 am
Location: Santa Cruz, CA

Postby amseek » Sat Jan 25, 2003 4:28 am

okay,

so.. I'm sooooo guessing on this, but I'm feebly attempting to get this by looking at examples of perl code from some of the addons

new coding (to get the other three input fields to plug in within the <li> </li> fields):

<ol>
<PerlCode>
$CustomField_trackauthor =~ s~\A[\;\s]*~~;
$CustomField_trackauthor =~ s~[\;\s]*\Z~~;
$CustomField_trackauthor =~ s~[;\s]*;~\;~g;
$CustomField_tracktitle =~ s~\A[\;\s]*~~;
$CustomField_tracktitle =~ s~[\;\s]*\Z~~;
$CustomField_tracktitle =~ s~[;\s]*;~\;~g;
$CustomField_trackmix =~ s~\A[\;\s]*~~;
$CustomField_trackmix =~ s~[\;\s]*\Z~~;
$CustomField_trackmix =~ s~[;\s]*;~\;~g;
$CustomField_tracklabel =~ s~\A[\;\s]*~~;
$CustomField_tracklabel =~ s~[\;\s]*\Z~~;
$CustomField_tracklabel =~ s~[;\s]*;~\;~g;
my @somethings = split( /\;/, [$CustomField_trackauthor, $CustomField_tracktitle, $CustomField_trackmix, $CustomField_tracklabel] );
foreach $_ (@somethings) {
$newshtml .= qq~<li>$_</li>~;
}
</PerlCode>
</ol>


big fat mess and yeah, I know it don't work, but maybe you can see where I'm trying to get to?


the output is giving me:

1) ARRAY(0x1022d784)
amseek
 
Posts: 37
Joined: Sun Jan 12, 2003 2:49 am
Location: Santa Cruz, CA

Postby amseek » Sat Jan 25, 2003 4:41 am

now trying:

<ol>
<PerlCode>
$CustomField_trackauthor =~ s~\A[\;\s]*~~;
$CustomField_trackauthor =~ s~[\;\s]*\Z~~;
$CustomField_trackauthor =~ s~[;\s]*;~\;~g;
$CustomField_tracktitle =~ s~\A[\;\s]*~~;
$CustomField_tracktitle =~ s~[\;\s]*\Z~~;
$CustomField_tracktitle =~ s~[;\s]*;~\;~g;
$CustomField_trackmix =~ s~\A[\;\s]*~~;
$CustomField_trackmix =~ s~[\;\s]*\Z~~;
$CustomField_trackmix =~ s~[;\s]*;~\;~g;
$CustomField_tracklabel =~ s~\A[\;\s]*~~;
$CustomField_tracklabel =~ s~[\;\s]*\Z~~;
$CustomField_tracklabel =~ s~[;\s]*;~\;~g;
my @somethings = split( /\;/, $CustomField_trackauthor );
my @somethings2 = split( /\;/, $CustomField_tracktitle );
my @somethings3 = split( /\;/, $CustomField_trackmix );
my @somethings4 = split( /\;/, $CustomField_tracklabel );
foreach $_ (@somethings, @somethings2, @somethings3, @somethings4) {
$newshtml .= qq~<li>$_</li>~;
}
</PerlCode>
</ol>


--am I sort of going in the right direction?
amseek
 
Posts: 37
Joined: Sun Jan 12, 2003 2:49 am
Location: Santa Cruz, CA

Postby amseek » Sat Jan 25, 2003 5:42 am

okay, one more....

trying:

<ol>
<PerlCode>
$CustomField_trackauthor =~ s~\A[\;\s]*~~;
$CustomField_trackauthor =~ s~[\;\s]*\Z~~;
$CustomField_trackauthor =~ s~[;\s]*;~\;~g;
$CustomField_tracktitle =~ s~\A[\;\s]*~~;
$CustomField_tracktitle =~ s~[\;\s]*\Z~~;
$CustomField_tracktitle =~ s~[;\s]*;~\;~g;
$CustomField_trackmix =~ s~\A[\;\s]*~~;
$CustomField_trackmix =~ s~[\;\s]*\Z~~;
$CustomField_trackmix =~ s~[;\s]*;~\;~g;
$CustomField_tracklabel =~ s~\A[\;\s]*~~;
$CustomField_tracklabel =~ s~[\;\s]*\Z~~;
$CustomField_tracklabel =~ s~[;\s]*;~\;~g;
my @combine = (split( /\;/, $CustomField_trackauthor )).(split( /\;/, $CustomField_tracktitle )).(split( /\;/, $CustomField_trackmix )).(split( /\;/, $CustomField_tracklabel ));
foreach $_ (@combine) {
$newshtml .= qq~<li>$_</li>~;
}
</PerlCode>
</ol>


--- I don't know...I think I might be on the right track, but I've never touched perl before and so I'm looking at some addon code for reference to try to see what would combine the fields

-thanks for the help
-art

p.s. with this configuration, it's adding up my number of entries and outputting like this:

1) 5555

??
amseek
 
Posts: 37
Joined: Sun Jan 12, 2003 2:49 am
Location: Santa Cruz, CA


Return to Troubleshooting

Who is online

Users browsing this forum: No registered users and 1 guest

cron