Using variables in the wysiwyg editor

5 posts by 2 authors in: Forums > CMS Builder
Last Post: August 6, 2009   (RSS)

By eduran582 - August 5, 2009

Hi all,

Does anyone know if there is a way to use CMSB variables within the wysiwyg editor when adding a record? What I need is a way to add certain variables in the text that would be added in a "content" wysiwyg field. Example: something entered into the wysiwyg field like this:

"Your reservation for <?php echo $myRecord['mytotal'] ?> of people has been made..."

TIA

Eric

Re: [eduran582] Using variables in the wysiwyg editor

By Chris - August 6, 2009

Hi eduran582,

Does the website maintainer need to change the text "Your reservation for" and "of people has been made" very often? That seems like the kind of thing that could be safely hardcoded into your PHP viewer file.

Does that help at all?
All the best,
Chris

Re: [eduran582] Using variables in the wysiwyg editor

By Chris - August 6, 2009

If you wanted to get your hands dirty with PHP, you could always create your own placeholder system. e.g.:

<?php
$content = $record['content'];
$content = str_replace("(***NUM***)", $record['num'], $content);
echo $content;
?>

All the best,
Chris

Re: [chris] Using variables in the wysiwyg editor

By eduran582 - August 6, 2009

Hmmm... interesting. Thanks for the hint, Chris! [;)]

I might try something like this after I get this thing going.

Eric