PHP: including 2 same php files in 1 page
-
20-09-2019 - |
Question
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
Solution
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.
OTHER TIPS
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).
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.
if the problem still persists, you could set error reporting to show all and see if there's any output