close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

php values in CMS content?

Thread began 1/31/2016 11:20 am by Steve | Last modified 12/22/2016 12:36 am by Steve | 2541 views | 7 replies

Ray BorduinWebAssist

It is more complex than that.

You could probably pull it off using the functions:

preg_match();
to find the php references and save them into an array.

and then:
eval()
to execute the php code and get the result

Then finally str_replace() to replace it.

It is worth noting that you will want to disable inline editing with either technique (yours or the more complex one) since any dynamic values would end up being replaced with their values as soon as the inline edits were saved.

I have gotten around this limitation to allow any dynamic value, but the solution becomes pretty complex. It involves using code like this for the placeholder:

<span class="php_replace" rel="$variablename">sample value</span>



Then I search through the code for anything with the "php_replace" class using preg_match() and when I replace it I only update the "sample value" portion and leave the rest of the tag intact. This way you can still use the inline editor, but if you replace the dynamic portion your edits are ignored and the value stays dynamic since you wouldn't ever actually remove the <span> and its class while editing.


Did this help? Tips are appreciated...

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...