Treby
Treby

Reputation: 1320

PHP: including 2 same php files in 1 page

i have a code

<div class="b4_content">
    <div class="col_left3 FloatLeft">
        <h3>Clients / Projects</h3>
        <div id="left_menu" class="left_menu">
          <?php
            require("admin/Connection/connection.php");
            require("admin/functions/functions.php");
            $toplvl=0;
            /* 1st include of linkCategory.php */
            include "admin/functions/linkCategory.php";
          ?>
        </div>
    </div>
    <div class="col_right3 FloatRight ">
        <div class="cright_padd">
          <?php
            $uploader="admin/";
            $catID = $_GET['catID'];                    
            if($catID==""){
                $toplvl=2;
                /* 2nd include of linkCategory.php */
                include "admin/functions/linkCategory.php";
            } else {
                $toplvl=0;
                include "admin/functions/viewImages.php";
            }
          ?>
        </div>
    </div>
    <div class="ClearBoth"></div>
</div>

As you can see i have 2 includes (admin/functions/linkCategory.php) with same pages My Problem is, the second include "admin/functions/linkCategory.php" does not show up.

Can you help me out

Upvotes: 1

Views: 199

Answers (4)

user70568
user70568

Reputation:

I guess $toplvl is a flag that's used within "admin/functions/linkCategory.php" to do different things. So, maybe the error isn't in this chunk, but in linkCategory.php itself.

Upvotes: 3

Raz
Raz

Reputation: 682

if the problem still persists, you could set error reporting to show all and see if there's any output

Upvotes: 0

outis
outis

Reputation: 77400

As an alternative, wrap whatever linkCategory.php outputs in a function. Include linkCategory.php once and replace the includes with a call to the function.

Upvotes: 0

mpen
mpen

Reputation: 282845

My guess is that $catID is NOT equal to the empty string.

And btw, bolding doesn't work inside code blocks (if that's what you were trying to do).

Upvotes: 2

Related Questions