On Fri, 18 Jul 2003, Curt Zirzow wrote:

} > Do you mean: 
} > 
} > $patterns[3] = "/###Image($count+1)###/";
} > $replacements[3] = "<html stuff....";
} 
} Actually I did mean to use the $patterns[]  and $replacements[], php
} will automatically increase the index for you kinda makes adding
} different pattern/replacement arrays easier in any order.
} 
} The array will by default be FIFO.

Ok, gotcha. 

} >$sel_image = "SELECT * from ppd_photos where ppd_id = '$_GET[ppdid]' AND  
place_holder = '$thephoto[0]'";

} What does this return?
} 
} I'm a bit confused right now..

The query simply returns one row with all the htmlstuff [width, height, 
caption, image_holder, etc] for one image. In otherwords, $message might 
contain:
                                                                                       
                                                             
---------------------
Hello world, look at my [b]cat[/b]: ###Image1### Nice, huh?
And now look at my [b]dog[/b]: ###Image2### Not so nice, eh?
---------------------

I'm using a big preg_replace call to replace any of that custom formatting 
tag [eg: [b][/b]] as well as the ###ImageX### tags. Instead of replacing 
###Image1### with some formatting code, I need to look up ###Image1### in 
the database, which stores the formatting codes. So the in the above 
query, $thephoto[0] contains '###Image1###', since it is the first photo 
on the page. However, when preg_replace finds a 2nd photo, with a 
image_holder of ###Image2###, the select statement is still run against 
the first image place holder, ###Image1###. So I need to advance the 
counter before running the SQL statement

If I leave out the sql stuff and do something like this:

$patterns[3] = "/###Image(\d+)###/si";
$replacements[3] = "My Photograph\$1";

Then the page sucessfully substitutes "My Photograph1" for every place 
that $message contained ###Image1### and "My Photograph2" for every place 
that $message contained ###Image2###. 

So I need to somehow run preg_match on that part of $message in order to 
extract ###Image1###, ###Image2###, ###Image3###, etc from the message and 
look them up in the database. I think. :-\

} after the user enters in his stuff, he wants, in your CMS and before you
} save it, parse it for all the special tags you have and keep track of it
} somewhere.  That way when you output it (in this script) you only need
} to apply the necessary pattern/replacements before outputing it to the
} browser.  

Good idea! Thanks very much!

Thanks again for your help, and time, with this. I do appreciate it.

/vjl/

-- 
Vince LaMonica               UC Irvine,  School  of  Social Ecology
 W3 Developer       <*>      116 Social Ecology I, Irvine, CA 92697
 [EMAIL PROTECTED]                  http://www.seweb.uci.edu/techsupport

Linux price to performance ratio: Error: Divide by zero. Continue?(Y/N)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to