1

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

quinestor
  • 1,432
  • 4
  • 19
  • 40
Treby
  • 1,328
  • 6
  • 18
  • 26
  • Why would you include the same page twice? – F.P Nov 16 '09 at 07:25
  • well i nid the same page. il just need to show level 1 and 2 of the category list. my indicator for that is $toplvl – Treby Nov 16 '09 at 07:28
  • Are you sure you are getting inside the conditional block to include it a second time? Try putting an echo "in here" after $toplvl=2; to make sure you are definitely hitting the include – Ian Nov 16 '09 at 07:29
  • Are you sure $catID==""? –  Nov 16 '09 at 07:31
  • BTW: if i commented the first include. the second include shows up.. – Treby Nov 16 '09 at 07:32
  • Could you post linkCategory.php code? –  Nov 16 '09 at 07:35
  • 2
    You don't have any functions, classes, or constants declared in `linkCategory.php`, do you? If you do... PHP will throw an error and cause your script to halt when it's included for the second time. – brianreavis Nov 16 '09 at 07:39
  • @Treby: also put an echo at top of 'linkCategory.php'. If it echoes twice, you know it's not the include that's failing. – outis Nov 16 '09 at 07:42

4 Answers4

3

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.

jason
  • 8,918
  • 2
  • 37
  • 43
  • Man your right.. nice guess.. i had a function in linkCategory.php, calling it twice will duplicate the created function. Thanks man. your thought helps. – Treby Nov 16 '09 at 07:38
  • That's the reason why I asked you to post linkCategory.php. :-) I gave +1 to Scott! –  Nov 16 '09 at 07:40
2

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).

mpen
  • 272,448
  • 266
  • 850
  • 1,236
0

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.

outis
  • 75,655
  • 22
  • 151
  • 221
0

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

Raz
  • 682
  • 1
  • 7
  • 19