Jump to content

martyf

Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Posts posted by martyf

  1. I've actually just solved this one myself with the assistance of a WordPress plug in (http://www.soeren-weber.net/data/2005/08/18/exec-php.zip)
    [code]function execphp_fix_tag($match)
    {
        $output = '<?php'. $match[2]. '?>';
        return $output;
    }
    function execphp_eval_php($content) {
    $pattern = '/'. '(?:(?:<)|(\[))[\s]*\?php'.
            '(((([\'\"])([^\\\5]|\\.)*?\5)|(.*?))*)'.
            '\?(?(1)\]|>)'.
            '/is';
        $content = preg_replace_callback($pattern, 'execphp_fix_tag', $content);
        ob_start();
        eval(" ?> $content <?php ");
        $output = ob_get_contents();
        ob_end_clean();
        return $output;
    }
    echo execphp_eval_php($content['page_content']);[/code]
  2. I've got a concept in my head but I'm not sure if I'm going to be able to get it working. What I want to do is have a single page for the site, and store all of the content in a database - there by running the site off of one page pretty much.

    However, some of the 'content' code includes PHP code itself. So what I have set up as a prototype is content in a database which gets extracted and 'echoed' to the screen. This is fine for HTML-only content, but a problem occurs when PHP is within that HTML code.

    Is there a way that I can 'echo' the data to the screen, but to parse any PHP that may be contained before echoing. I have thought of a few ways around (writing a function to break up the string, or using the ob_start() features, but still have the issue of parsing the code.

    Does any one have any suggestions?

    Cheers,
    Marty
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.