Forums

PHP Include - Pages Bouncing Out of Wordpress (Exec-PHP) (2 posts)

  1. thefluffyshrimp
    Member
    Posted 3 months ago #

    Hello! :-)

    I recently installed the Exec-PHP plugin and have been using PHP include commands to embed scripts into my Wordpress pages.

    So far it works almost perfectly, but I've been having one problem.

    Whenever a link or button is clicked on one of these pages, the page will "bounce" out of Wordpress.

    You can see what I mean by visiting this page --> http://thefluffyshrimp.com/?page_id=9

    If you click the button "Add Link" at the bottom there (without filling in the form), the error page will open up outside of Wordpress. Whereas I would prefer all links to open up inside the Wordpress page.

    This is particularly important for users attempting to include PHP scripts that involve a number of pages, such as a gallery or a links directory (ex: Page 1 / 2 / 3 / Next Page), each page of which would open up outside of Wordpress when clicked.

    To illustrate this problem, let's say I use the following code in my included file and name it "page1.php"

    <?php
    echo "(This Is A Link To Page 2)";
    ?>

    So that page1.php contains a link to page2.php.

    Now on my Wordpress page I will include the following.

    <? php
    include "/dir/dir/page1.php";
    ?>

    If I do this, page1.php will appear in my Wordpress page just beautifully...

    But when I click the link "This Is A Link To Page 2" to go to page2.php, page2.php will appear as a stand alone page (it won't appear inside the Wordpress page as page1.php does).

    Now I'm certain there is a way to get all pages that you click on to appear embedded inside the same Wordpress page (without using frames/iframes), but I'm not sure where to start.

    Is there an additional, preexisting plugin that assists with this reoccurring issue with Exec-PHP? Or is there a blog about how to do this that anyone knows of?

    How can I get all clicked links in a PHP include to open within the same page (again, without using frames)?

    Thank you so much to anyone willing to take the time to assist me with this. :-)

  2. chriscupas
    Member
    Posted 2 months ago #

    try

    <? php
    include "dir/dir/page1.php";
    ?>

    then regarding to this one

    "Warning: Cannot modify header information - headers already sent"

    you may want to use the built in function of php which is

    ob_start(); - it should be placed on top

    ob_end_flush(); - to make it cleaner

Reply

You must log in to post.

About this Topic