garethdaine Posted May 23, 2011 Share Posted May 23, 2011 Hi Folks, This is my first post here and I was wondering if anyone could help me out at all please. I would basically like to change the logo on the home page based on whether a query string from a referring URL has a specific value. It's an affiliate URL for an online store, so essentially I need to get the referrer, check if the query string adnetwork = as and then replace the logo if it does, if not leave it as it is. Does that make sense? Any help would very much appreciated. I was thinking along the lines of: <?php if ($_GET('adnetwork') == 'as') { changeLogo(); } else { leaveLogo(); } ?> Am I along the right lines folks? Quote Link to comment https://forums.phpfreaks.com/topic/237215-chenging-page-content-logo-based-on-referring-url-query-string/ Share on other sites More sharing options...
fugix Posted May 23, 2011 Share Posted May 23, 2011 that could be onne way of doping it. you can also look into using curl to grab data from a url Quote Link to comment https://forums.phpfreaks.com/topic/237215-chenging-page-content-logo-based-on-referring-url-query-string/#findComment-1219058 Share on other sites More sharing options...
garethdaine Posted May 23, 2011 Author Share Posted May 23, 2011 Hi, Thanks for the reply. I'm pretty new to PHP so don't really understand your code. I'm thinking that this may work: <?php $referrer = $SERVER['HTTP_REFERRER']; if $referrer($_GET('adnetwork') == 'as') { changeLogo(); } else { leaveLogo(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/237215-chenging-page-content-logo-based-on-referring-url-query-string/#findComment-1219060 Share on other sites More sharing options...
garethdaine Posted May 23, 2011 Author Share Posted May 23, 2011 Would this work? The JS file uses jQuery to replace the img src. Not sure how to do this in PHP. <?php $referrer = $SERVER['HTTP_REFERRER']; if $referrer($_GET('adnetwork') == 'as') { print '<script language="javascript" src="<?php echo $this->getSkinUrl(js/logo-replace.js) ; ?>"></script>'; } else { } ?> Quote Link to comment https://forums.phpfreaks.com/topic/237215-chenging-page-content-logo-based-on-referring-url-query-string/#findComment-1219064 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.