Is it possible to select parts of a php file but omit others?

Basically i have this:

<?php include ‘php/entry001.php’; ?>

would it be possible to just select a range from that file, and omit others when i include it? I want to select a few paragraphs from it and not the entire file.

2 Responses to “Is it possible to select parts of a php file but omit others?”

  • the DtTvB:

    You can still use include.. You can use an if in the entry to check what part you want.

    For example:

    <?php
    $showfullcontent = false;
    include ‘php/entry001.php’;
    ?>

    And now for the entry:

    <p>Briefing…</p>
    <p>Briefing…</p>
    <p>Briefing…</p>
    <?php if ($showfullcontent): ?>
    <p>Full contents here.</p>
    <?php endif; ?>

  • arsenique13:

    Instead of using the "include" command, use the "require" command.
    You’ll then be able to call specific functions from the page you refer to like if the functions where on the current page…

Leave a Reply