append beginning of wysiwyg field

4 posts by 2 authors in: Forums > CMS Builder
Last Post: July 27, 2010   (RSS)

By Deborah - July 27, 2010

I would like to add standardized text to the beginning of the first sentence in a wysiwyg field when displayed. Example:

If WYSYWYG content is entered as "15 Water Street", I'd like to display on generated web page: "Where: 15 Water Street"

Using info from a previous forum post, I think what I need to do is first strip out the leading paragraph tag, then add it back with the text I want to include.

I tried this:
<?php $record['where_1'] = preg_replace("/^\s*<p>/i", "<p><strong>Where: </strong>", $record['where_1'] ); ?>

and this:
<p><strong>Where: </strong><?php $record['where_1'] = preg_replace("/^\s*<p>/i", "", $record['where_1'] ); ?>

I must not have something right, because the field content does not display at all on the web page using either of the above code. Can anyone assist?

Re: [Deborah] append beginning of wysiwyg field

By Jason - July 27, 2010

Hi,

If you could send me attach a copy of you .php file and give me a link to where the page is suppose to display, I can take a look at it for you.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Deborah] append beginning of wysiwyg field

By Jason - July 27, 2010

Glad to hear everything is working now.

Please let me know if you run into any other issues.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/