Newbie needs help with url and conditionals

Hi all

I am trying to include a JS script into the head of a secondary page, but not in any other page. The head is a global include.

I’ve tried many bits of code I have seen, nothing working.

Basically I need this:

if url( {
<script>This is a JS script</script>


Hi, welcome to SitePoint. :slight_smile:

Check out $_SERVER[‘REQUEST_URI’].

Give the URL,, it should contain, /products/view.

You can use this as your ‘switch’ to test against.

<?php if('/products/view' === $_SERVER['REQUEST_URI']): ?>
  <script type="text/javascript" src="assets/js/jquery/jquery-1.3.2.min.js"></script>
<?php endif; ?>

Hi Anthony

Thanks so much. That works perfectly and simpler then I thought.

THanks again for the speedy help!