calling a function within html entity decode

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mananx
Forum Newbie
Posts: 1
Joined: Wed Jan 21, 2009 8:03 am

calling a function within html entity decode

Post by mananx »

Hi ,

My site has a backend , the backend stores data through a WYSISYG editor . This editor is using htmlentities function to store any changes in the database through backend .

To display the data stored my site uses htmlentitydecode() function by fetching an object from database .

I want to include a php function in the site , however when i enter php function through backend , it simply echoes all php code . e.g. <?php echo "hello"; ?>

page displaying code is php itself.

Any way to get around this problem ?

Thanks
mattpointblank
Forum Contributor
Posts: 304
Joined: Tue Dec 23, 2008 6:29 am

Re: calling a function within html entity decode

Post by mattpointblank »

Do you not have access to the backend code so you can change the function or something? You could modify the function like so:

Code: Select all

 
function processForBackend($input, $on=true) {
    if($on) {
        // do stuff to clean up code
    } else {
        return $input;
    }
 
}
 
Then normal calls can just stay like processForBackend("hello"), and PHP can be called like processForBackend("<?php echo "hello"; ?>, false); (untested, but should be okay).
Post Reply