Thomshaw
-
Posts
5 -
Joined
-
Last visited
Never
Posts posted by Thomshaw
-
-
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!
-
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!
-
Sorry, dont know how to edit post the </script> isnt there, is a reference to whats in the div i copied accross!
-
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
return string after and including $needle in the string $haystack
in PHP Coding Help
Posted
Amazing guys thanks a lot, I'm trying to learn as I code and am just working out what everything is, means, and references. I hate being a noob!