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

8
  • Why would you include the same page twice? Commented Nov 16, 2009 at 7: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 Commented Nov 16, 2009 at 7: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 Commented Nov 16, 2009 at 7:29
  • Are you sure $catID==""? Commented Nov 16, 2009 at 7:31
  • 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. Commented Nov 16, 2009 at 7:39

4 Answers 4

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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.
That's the reason why I asked you to post linkCategory.php. :-) I gave +1 to Scott!
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).

1 Comment

It is an empty string. coz i tried echoing inside the condition
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.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.