Mucker Posted June 18, 2013 Share Posted June 18, 2013 The first block of code is what i want to use since i know it works, but i dont know how to use it with the code already there. <?php if (strpos($_SERVER['REQUEST_URI'], 'upload.php') == false) { echo 'the stuff below is removed, or if the URL is something else, its not removed' ?> This code is already in my form and can not be changed!!! This is what I want to remove totally if the URL is upload.php <div class="navbar" name"navbar" Id="navbar"> <div class="navbar-inner" name="navbar-inner" Id="navbar-inner">' <?php echo a_view('core/account/login_dropdown'); ?> <?php echo a_view_menu('topbar', array('sort_by' => 'priority', array('menu-hz'))); ?> <?php echo a_view('search/search_box', array('class' => 'search-header')); ?> </div> </div> Can anyone help? Quote Link to comment Share on other sites More sharing options...
requinix Posted June 18, 2013 Share Posted June 18, 2013 if (you do want to show that stuff) { ?> the stuff } ?> Quote Link to comment Share on other sites More sharing options...
ginerjm Posted June 18, 2013 Share Posted June 18, 2013 Have no idea what you are trying to do, but try this. <?php if (strpos($_SERVER['REQUEST_URI'], 'upload.php') == false) { echo 'the stuff below is removed, or if the URL is something else, its not removed' } else { echo '<div class="navbar" name"navbar" Id="navbar">'; echo '<div class="navbar-inner" name="navbar-inner" Id="navbar-inner">'; echo a_view('core/account/login_dropdown'); echo a_view_menu('topbar', array('sort_by' => 'priority', array('menu-hz') ) ); echo a_view('search/search_box', array('class' => 'search-header')); echo '</div> </div>'; } This would prevent the second part from being output. Note - there is at least one error in that code, so I don't think it's working as shown. Also your first if statement is backwards if you want the "else" stuff dropped if the uri is upload.php Quote Link to comment Share on other sites More sharing options...
Mucker Posted June 18, 2013 Author Share Posted June 18, 2013 Have no idea what you are trying to do, but try this. <?php if (strpos($_SERVER['REQUEST_URI'], 'upload.php') == false) { echo 'the stuff below is removed, or if the URL is something else, its not removed' } else { echo '<div class="navbar" name"navbar" Id="navbar">'; echo '<div class="navbar-inner" name="navbar-inner" Id="navbar-inner">'; echo a_view('core/account/login_dropdown'); echo a_view_menu('topbar', array('sort_by' => 'priority', array('menu-hz') ) ); echo a_view('search/search_box', array('class' => 'search-header')); echo '</div> </div>'; } This would prevent the second part from being output. Note - there is at least one error in that code, so I don't think it's working as shown. Also your first if statement is backwards if you want the "else" stuff dropped if the uri is upload.php Can you define how it's backwards? I am working on a website with a friend, and we are just stuck on this bit. If you could fix the code, I would be most greatful Quote Link to comment Share on other sites More sharing options...
Mucker Posted June 18, 2013 Author Share Posted June 18, 2013 I can't edit my post so i am bumping it to explain what i need. Basically ginerjm from the second block of code. Thats from another php script, but i need to exclude that php script becuase I don't want it visible on the page i am working on, but I need it visible on other pages. Quote Link to comment Share on other sites More sharing options...
Solution ginerjm Posted June 18, 2013 Solution Share Posted June 18, 2013 (edited) And that's what I deduced. As for your error. Your original post: <?php if (strpos($_SERVER['REQUEST_URI'], 'upload.php') == false) { echo 'the stuff below is removed, or if the URL is something else, its not removed' ?> is flawed. You are missing the closing curly bracket as well as a semi at the end of the echo. So obviously you've never run this code. Anyway this statement says "if the uri does NOT contain 'upload.php' show the message 'stuff is removed'. You were close - you just have to include the code that you wanted to remove. So - taking my post and correcting it you would have: <?php if (strpos($_SERVER['REQUEST_URI'], 'upload.php') == false) { echo '<div class="navbar" name"navbar" Id="navbar">'; // this line has an error echo '<div class="navbar-inner" name="navbar-inner" Id="navbar-inner">'; echo a_view('core/account/login_dropdown'); // I'm assuming that "a_view" is some function defined somewhere echo a_view_menu('topbar', array('sort_by' => 'priority', array('menu-hz') ) ); // again - a function call? echo a_view('search/search_box', array('class' => 'search-header')); echo '</div> </div>'; } Now the code will NOT be displayed if the uri contains your script name. Edited June 18, 2013 by ginerjm Quote Link to comment Share on other sites More sharing options...
Mucker Posted June 18, 2013 Author Share Posted June 18, 2013 thank you very much friend Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.