4 Replies Latest reply: Jun 13, 2014 8:39 AM by jyeager11 RSS

    Proper PHP syntax for importing code (beginner)

    jyeager11 Community Member

      $poststart = "<!-- Begin -->";

      $poststop = "<!-- End -->";

       

      $parsedpost1 = explode($poststart, $contenu);

      $parsedpost2 = explode($poststop, $parsedpost1[1]);

      $contenu = $parsedpost1[0] . $poststart . $newpost . $poststop . $parsedpost2[1];

       

      The above code will set 2 markers and replace whatever's inside by $newpost, which is defined elsewhere in the page. But what if $newpost is so long that I'd be more comfortable storing it in a separate file? How would I go about calling said file on that last line (where $newpost is)? (I know about regular includes, but trying to place one directly into that line didn't work.)

       

      I'm really just looking for proper syntax.

       

      Thanks!