[CLUG] TECH/PHP question

Fixer fixer at vigilante.net
Tue Oct 23 20:54:49 IST 2001


I was already on that path, but I think I have a more complex need.
For one image & associated info, this works great, but I have 10 of
each, and the data needs to stay aligned 1-10.

For example, if there is no caption text for image 5, the image array
will only have 9 items...of if I flipped the array, I would end up with
the delete value in the caption slot.


contents of text file:

file1.jpg}this is a caption
file2.jpg}this is a caption
file3.jpg}
file4.jpg}this is a caption
file5.jpg}this is a caption
file6.jpg}this is a caption
file7.jpg}this is a caption
file8.jpg}this is a caption
file9.jpg}
file10.jpg}this is a caption



multidimensional array coming from the html form:


var     $file           $caption/text input     checkbox        radio

1       file1.jpg               this is a caption               delete
2       file2.jpg               this is a caption
3       file3.jpg
4       file4.jpg               edit this caption
5       file5.jpg               this is a 
caption                               mainimg
6       file6.jpg               this is a caption
7       file7.jpg               this is a caption
8       file8.jpg               this is a caption               delete
9       file9.jpg
10      file10.jpg      this is a caption



I am unclear how to reference a multidimensional array in the html form.
I can't use just one array per line/loop, due to the syncing problems.

Maybe I will just check for a null $new_caption and make it "no caption" and
remove that text in display.  that would keep [0] and [1] consistent...




At 20:30 23/10/2001 +0100, ad at m.beecher.net wrote:
>I'm guessing this is what you mean:
>
>http://ie.php.net/manual/en/faq.html.php#AEN63401
>
>If I'm wrong, tell me. If you need further help, ask. :)
>
>adam
>
>____________________________________________
>
>Adam Beecher - CEO & Core Geek - ieWebsT
>
>e  ...  ad at m.beecher.net
>w  ...  http://www.iewebs.com
>m  ...  Box 81, Eglinton St, Cork, Ireland
>____________________________________________
>
>
> > -----Original Message-----
> > From: cork-admin at linux.ie [mailto:cork-admin at linux.ie]On Behalf Of Fixer
> > Sent: 23 October 2001 20.17
> > To: cork at linux.ie
> > Subject: [CLUG] TECH/PHP question
> >
> >
> > I have a file on the filesystem with the following format:
> >
> > name.jpg}caption1
> > name2.jpg}caption2
> > ...
> > nameN.jpg}captionN
> >
> > if you can guess, it's for an image gallery.  Appending new lines
> > on a file
> > upload process is quite easy with fopen/fput.  The trick comes in
> > when I have
> > multiple, say 10, images listed and now want to delete one or change the
> > caption.
> > I am using php.
> >
> > I can read the file into an array which leaves each line as an element in
> > the array,
> > and if I for loop thru it, I can use list to make $filename and $caption
> > variables.
> > Display of each in an html form is no problem.  I currently have
> > a copy of the
> > thumbnail image, a text field with the caption and a "delete" checkbox.
> >
> > The issue is how do I capture the new data for all 10 caption
> > fields and then
> > edit the config file from earlier?  I haven't quite gotten my
> > head wrapped
> > around
> > multidimensional arrays, or even if they are appropriate for
> > this.  I think
> > I have
> > over thought it, so I am turning to others for a bit of inspiration.
> >
> >
> >
> >
> >
> > --
> > fix.er \'fik-s*r\ n : one that fixes : as : one that intervenes to
> >     enable a person to circumvent the law or obtain a political
> >     favor : one that adjusts matters or disputes by negotiation
> >
> >
> > _______________________________________________
> > Cork maillist  -  Cork at linux.ie
> > http://www.linux.ie/mailman/listinfo/cork
> >


--
fix.er \'fik-s*r\ n : one that fixes : as : one that intervenes to
    enable a person to circumvent the law or obtain a political
    favor : one that adjusts matters or disputes by negotiation





More information about the Cork mailing list