Jump to content

Dannyeo

New Members
  • Posts

    9
  • Joined

  • Last visited

Dannyeo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Dannyeo

    Curl

    Thanks Scootstah. Done the job nicely and thanks for the advice. Much appreciated.
  2. Dannyeo

    Curl

    Hi there I am trying to redirect mobile users automatically from the desktop to the moble version of a website. I have been provided with the following Curl code which I have placed in the Header.php file of my Wordpress site. I have confirmed with my Hosting provider who have said they do support Curl statements. Unfortunately I am getting a parse error in line 8: Parse error: syntax error, unexpected ';', expecting ')' <?php $domain_www = 'http://mydomain.co.uk'; $domain_mobi = 'http://m.mydomain.co.uk'; // Manually specify page by page redirects $mobile_urls = array($domain_www.'/' => $domain_mobi.'/', // Homepage $domain_www.'/page.php' => $domain_mobi.'/page.php', // Leave the code below unchanged to execute the mobile redirect $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.someotherdomainsomwhere.com/detect-mobile.php"); // returns if mobile $fields_string = 'usr='.urlencode($_SERVER['HTTP_USER_AGENT']).''; curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); $response = htmlentities($output); if(trim($response) == '1') { foreach ($mobile_urls as $i => $value) { if(strtolower('http://'.$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"])==strtolower($i)) { Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: ".strtolower($value) ); exit(); } } } ?> Any help would be much appreciated. Even if I remove the ; from line 8 I then get an error on line stating Parse error: syntax error, unexpected T_STRING, expecting ')' Also, where would you recommend storing this code on a Wordpress installation? Thanks DY
  3. Thanks again for everyones help on this.
  4. Thanks mrMarcus - I just posted a reply at the same time as your post. Yes you are spot on. As soon as I made the change to the CSS display:none; by removing this line it is all working. Thanks for your help. Much appreciated.
  5. I've just done a test by removing the div element. So the following code displays the banners in the header (though they are not in the correct place due to no mention to the CSS to align them): function pokies_header_468_60_banner() { ?> <?php echo adrotate_group(16); ?> <?php } So, the above works OK. Just the alignment of the banners is missing. So when I now add the CSS reference to align the banners it all stops working (despite the source code looking ok): function pokies_header_468_60_banner() { ?> <div class="header_banner" > <?php echo adrotate_group(16); ?> </div> <?php }
  6. An extract from the css is .header_banner { float: right; margin-top: 38.5px; margin-right: 50px; position:relative; overflow:hidden; width:468px; height:60px; } .header_banner a { /*opacity:0; filter:alpha(opacity=0);*/ display:none; position:absolute; top:0px; left:0px; }
  7. I'm seeing what I think I should be seeing in the source code: <div class="header_banner" > <a href="http://www.domain.com" rel="nofollow" target="_blank"><img src="http://imagelocation.com/image.gif" /></a> </div>
  8. Thanks for our help. I've tried the code above but it is crashing the site. It is definitely the div code that is causing me problems. For example I have some sidebar banners that work with the following code: function pokies_sidebar_160_600_banner() { ?> <?php echo adrotate_group(13); ?> <?php } So the real issue I have is how to incorporate the <div class="header_banner" > into the following code which isn't working: function pokies_header_468_60_banner() { ?> <div class="header_banner" > <?php echo adrotate_group(16); ?> </div> <?php }
  9. Hi Would anyone be able to offer some advice? Currently stuck. I have the following code within a PHP file that controls the header banners on my website. function pokies_header_468_60_banner() { ?> <div class="header_banner" > <?php echo adrotate_group(16); ?> </div> <?php } The banners are not appearing on the site and I think its down to me incorrectly using div and php together in the above code. Any advice would be appreciated - sorry if this is simple but I'm new to this and learning as I go along
  10. Dannyeo

    Hello

    Hello Just thought I'd pop in and say hello. Looks like a great community.
×
×
  • 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.