Jump to content

Thomshaw

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Posts posted by Thomshaw

  1. Hello all,

     

    I'm trying to change the end of a javascript call based on the end of the url string. The common part of all the url strings is sobi2Id=, I'm trying to do this with strstr but am having no luck. I'm new to php so my syntax knowledge is terrible!

     

    at the moment i've got

     

    <?php
    
    		    	$url = $_SERVER['REQUEST_URI'];
    
    	    	$tag = strstr ($url, 'sobi2Id=');
    
    		    	echo $tag; 
    ?>

     

    but this returns an unexpected T_STRING, expecting ',' or ';'

     

    Can anyone debug this? I may well be being really silly!

  2. Amazing CPD thanks so much, worked with a little jiggery pokery

     

     

    <?php 
    
    		   if (strpos($_SERVER['REQUEST_URI'], 'foo') == false) {
        		   echo '<div id="stuffdiv">stuff</div>';}
    
    	?>

     

    where foo appears in the url of the page on which the div should be hidden

     

    Again, can't thank you enough!

  3. Hi all,

     

    Relitively new to PHP but am trying to code a site that dynamically creates urls using Joomla CMS. Basically I'd like a div to show on pages' url starts /component/.... but hide it if not. The urls of the pages on which the div is to be hidden start /index.php?.

     

    I've tried

     

    
    <?php 
    
    		   if (strpos($_SERVER['REQUEST_URI'], 'component') > 0) {
    		   echo '<div id=\"stuffdiv\">stuff</script></div>';}
    
    	?>
    
    

     

    only issue is... its always fasle hence the div never shows. If i replace > with >= its always true, and appears on all pages, even those not containing 'component'...

     

    Can someone tell me if this should work or if Im being really stupid?

     

    Thanks in advance! Tom

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.