Vince LaMonica <[EMAIL PROTECTED]> wrote:
> Hi All,

hello

 
> [...]
> function vjencode($message) {
>  
>  $message = " " . $message ;
> 
> ##--- [b] and [/b] for bolding text.
>  $message = preg_replace("/\[b\](.*?)\[\/b\]/si", "<b>\\1</b>", $message);
> 
> ##--- [i] and [/i] for italicizing text.
>  $message = preg_replace("/\[i\](.*?)\[\/i\]/si", "<i>\\1</i>", $message);

btw, you know you can do this in one step:

$message = preg_replace("/\[(i|b)\](.*?)\[\/(i|b)\]/si", "<\$1>\$2</\$3>", $message);

> [...] 
> ##--- display photos [having problems with this]
> $patterns[3] = "#\#\#\#Image(.*?)\#\#\##si"; 
> // this matches just fine strings like ###Image1### and ###Image2###

I would change mabey make sure you catching a digit and the serpator for
readabilty /###Image(\d+)###/si

> [...] 
>  if ($_GET[ppdid] != "") { // the ppdid var is passed in the URL 
>  $sel_image = "SELECT * from ppd_photos where ppd_id = '$_GET[ppdid]' AND 
> place_holder = '$thephoto[0]'";
> // in this case, the page with a ppdid of '3' has 2 images, who's 
> // placeholders are: ###Image1### and ###Image2###
>  $sel_image_result = safe_query($sel_image);
>  $sel_image_row = mysql_fetch_array($sel_image_result);
>  $image_id = $sel_image_row["image_id"];
>  $image_name = $sel_image_row["image_name"];
>  $caption = $sel_image_row["caption"];
>  $width = $sel_image_row["width"];
>  $height = $sel_image_row["height"];
>  $image_alignment = $sel_image_row["image_alignment"];
> // replacements[3] is all one one line -sorry about word wrap!
>  $replacements[3] = "<br><table border=0 cellspacing=2 cellpadding=0 
> width=\"$width\" align=\"$image_alignment\"><tr><td><img 
> src=\"/uimages/$image_name\" 
> height=\"$height\" width=\"$width\" border=1></td></tr><tr><td><font 
> class=\"caption\">$caption<font></td></tr></table><br>";
> }

The only solution I can think of is while your looping through the
images they have  build more pattern/replacemen array items

foreach (row in db)
   $pattern[] = /###Image($count+1)###
   $$replacements[] = "<htmlstuff>$image_name</htmlstuff>";

Curt
-- 



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

Reply via email to