Question:

How do I include multiple files in PHP with only one variable?

by  |  earlier

0 LIKES UnLike

I have a PHP template that has two areas: a content area and a sub menu area. When I type in an address like:

www [dot] my_web_address [dot] com [slash] index [dot] php?variable=thisthinghere

I want to call the relevant content AND the relevant sub menu. How do I do it?

 Tags:

   Report

1 ANSWERS


  1. UPDATE:

    Ok,

    So, do you want the relationship between content pages and menu pages to be coded into the content page, or the index page?

    Assuming the former, set up c1.php like this:

    <?php $_REQUEST[ 'submenu' ] = 'm1.php'; ?>

    then, in index.php, wher you want the submenu:

    <?php include( $_REQUEST[ 'submenu' ] ); ?>

    on the other hand,

    If you want the relationship between content pages and menu pages to be coded into the index page, simply use an associative array to relate content to submenu.

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.