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
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
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?
Chris
Re: [chris] Using variables in the wysiwyg editor
By eduran582 - August 6, 2009
Thanks for replying. I figured because of the nature of the "wysiwyg" that this would not be a possibility but wanted to make sure. I've already told the maintainer they will have to revise the message they maintain to reflect a reference to the variables that will be displayed before the "content" is displayed (as in a header). So what I displayed would be changed to say something like:
"Your reservations for the number of people, as displayed above, has been made."
Thanks again for the quick reply.
Eric
Re: [eduran582] Using variables in the wysiwyg editor
By Chris - August 6, 2009
<?php
$content = $record['content'];
$content = str_replace("(***NUM***)", $record['num'], $content);
echo $content;
?>
Chris
Re: [chris] Using variables in the wysiwyg editor
By eduran582 - August 6, 2009
I might try something like this after I get this thing going.
Eric