php Code in mysql Datenbank

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • php Code in mysql Datenbank

    Hallo,
    um sowenig wie möglich seiten zu generieren, liegt der Hauptteil meiner Seiten in einer mysql Datenbank. So bleibt die Navigation usw. in einer Datei nur der eigentliche Inhalt wird aus der mysql Datenbank ausgelesen. Bisher liegt dort nur html Code. Ich müsste jedoch nun php Code in die Seite einfügen. Das bekomme ich leider nicht hin. Hat jemand eine idee was ich verändern muss?

    Die Datei in der es an die Stelle von $code eingefügt werden soll - sieht so aus:
    <?
    include("mysql/mysql_my_data.php");
    $query="select * from tblinhalt where Nr=$Nr";
    include("mysql/mysql_query.php");
    echo $head;
    include("include_global/kopf.php");
    include("include_global/banner.php")
    ?>

    <table border="0" cellpadding="0" cellspacing="0" width="760" height="60%">
    <tr>
    <td width="150" class="tdauswahl" valign="top">
    <table border="0" cellpadding="2" cellspacing="2" width="100%">
    <tr>
    <td width="100%">
    <?
    include("include_leistungen/auswahl.php")
    ?>
    </td>
    </tr>
    <tr>
    <td width="100%">
    &nbsp;
    </td>
    </tr>
    <tr>
    <td width="100%">
    &nbsp;
    </td>
    </tr>
    </table>
    </td>
    <td width="460" valign="top">
    <table border="0" cellpadding="2" cellspacing="2" width="100%">
    <tr>
    <td width="100%">
    <?
    echo $code
    ?>
    </td>
    </tr>
    </table>
    </td>
    <td width="150" valign="top">
    <table border="0" cellpadding="2" cellspacing="2" width="100%">
    <tr>
    <td width="100%">
    <?
    include("include_global/auswahl_rechts.php")
    ?>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    <?
    include("include_global/fuss.php");
    ?>

  • #2
    Vgl. http://www.php.net/manual/en/function.eval.php

    Und das HTML musste dann eben in echoes packen:

    PHP-Code:
    $code = preg_replace("!\?>(.*?)<\?!","?><?echo '$1';?><?",$code);
    $code = preg_replace("!^(.*?)<\?!","<?echo '$1';?><?",$code);
    $code = preg_replace("!\?>(.*?)$!","?><?echo '$1';?>",$code);

    CAT Music Files

    Kommentar

    Lädt...
    X