Re: [PHP] using image place holders in a database field?
I am going to take this sideways and push my own agenda. :-) In your position, I would consider storing the newsletter text as blobs of XML. Keep it dead simple to start with: which would make your article text: the article text image_name some more article text and you could then use eregi_replace to turn into HTML: $text = "the article text image_name some more article text"; // Remove the "blob" tags $text = eregi_replace( "<[\/]?blob>", "" , "", $text ); // Resolve the image element $text = eregi_replace("([^#]+)", "", $text) Disadvantages: * A little more complex up front Advantages: * You have given yourself room to move if you need to start expanding on what you can do with inline markers At 15:38 11/07/2001 +1200, Matthew Delmarter wrote: >Hi all, > >I want to use image place holders in a mysql field. The field will store a >newsletter article and I want to include and display an image in the >article. > >For example I will have: >"the article text ##image_name## some more article text". > >I will use str_replace to replace ##image_name## with the html tag to >display such as . > >But - I don't know how to write the str_replace! Can anyone help? > >Also, is there are better way to do this?? Can I have images displayed in >the middle of text from a field some other way? > >I also cannot seem to find much on using place holders in a field - but I >can see it's advantages. > >I hope this all makes sense... > >Regards, > >Matthew Delmarter > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] - Brian White Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy Phone: +612-93197901 Web: http://www.steptwo.com.au/ Email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] using image place holders in a database field?
Oops. That should've been $string = ereg_replace("##([^#]+)##", "", $string); - Original Message - From: "Philip Murray" <[EMAIL PROTECTED]> To: "Matthew Delmarter" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, July 11, 2001 3:57 PM Subject: Re: [PHP] using image place holders in a database field? > This should do it for you > > > $string = "Here is a picture ##flowers.jpg## of some flowers"; > $string = ereg_replace("##(.+)##", "", $string); > > print($string); > // prints 'Here is a picture of some flowers' > > ?> > > The "##(.+)##" parts matches any string with two # at the start and the end, > the part replaces the ##string## with . > The \\1 is a reference to the string matched with (.+) in the first > parameter. '.+' matches any character 1 or more times. > > - -- - - - > Philip Murray > [EMAIL PROTECTED] > - - -- - - > > - Original Message - > From: "Matthew Delmarter" <[EMAIL PROTECTED]> > To: "PHP Mailing List" <[EMAIL PROTECTED]> > Sent: Wednesday, July 11, 2001 3:47 PM > Subject: [PHP] using image place holders in a database field? > > > > Hi all, > > > > I want to use image place holders in a mysql field. The field will store a > > newsletter article and I want to include and display an image in the > > article. > > > > For example I will have: > > "the article text ##image_name## some more article text". > > > > I will use str_replace to replace ##image_name## with the html tag to > > display such as . > > > > But - I don't know how to write the str_replace! Can anyone help? > > > > Also, is there are better way to do this?? Can I have images displayed in > > the middle of text from a field some other way? > > > > I also cannot seem to find much on using place holders in a field - but I > > can see it's advantages. > > > > I hope this all makes sense... > > > > Regards, > > > > Matthew Delmarter > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] using image place holders in a database field?
This should do it for you ", $string); print($string); // prints 'Here is a picture of some flowers' ?> The "##(.+)##" parts matches any string with two # at the start and the end, the part replaces the ##string## with . The \\1 is a reference to the string matched with (.+) in the first parameter. '.+' matches any character 1 or more times. - -- - - - Philip Murray [EMAIL PROTECTED] - - -- - - - Original Message - From: "Matthew Delmarter" <[EMAIL PROTECTED]> To: "PHP Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, July 11, 2001 3:47 PM Subject: [PHP] using image place holders in a database field? > Hi all, > > I want to use image place holders in a mysql field. The field will store a > newsletter article and I want to include and display an image in the > article. > > For example I will have: > "the article text ##image_name## some more article text". > > I will use str_replace to replace ##image_name## with the html tag to > display such as . > > But - I don't know how to write the str_replace! Can anyone help? > > Also, is there are better way to do this?? Can I have images displayed in > the middle of text from a field some other way? > > I also cannot seem to find much on using place holders in a field - but I > can see it's advantages. > > I hope this all makes sense... > > Regards, > > Matthew Delmarter > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] using image place holders in a database field?
Hi all, I want to use image place holders in a mysql field. The field will store a newsletter article and I want to include and display an image in the article. For example I will have: "the article text ##image_name## some more article text". I will use str_replace to replace ##image_name## with the html tag to display such as . But - I don't know how to write the str_replace! Can anyone help? Also, is there are better way to do this?? Can I have images displayed in the middle of text from a field some other way? I also cannot seem to find much on using place holders in a field - but I can see it's advantages. I hope this all makes sense... Regards, Matthew Delmarter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] using image place holders in a database field?
Hi all, I want to use image place holders in a mysql field. The field will store a newsletter article and I want to include and display an image in the article. For example I will have: "the article text ##image_name## some more article text". I will use str_replace to replace ##image_name## with the html tag to display such as . But - I don't know how to write the str_replace! Can anyone help? Also, is there are better way to do this?? Can I have images displayed in the middle of text from a field some other way? I also cannot seem to find much on using place holders in a field - but I can see it's advantages. I hope this all makes sense... Regards, Matthew Delmarter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]