Jump to content

IanS

Members
  • Posts

    20
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://
  • ICQ
    0

Profile Information

  • Location
    London, UK
  • Interests
    Anything that's interesting, and even some things that are not interesting.

IanS's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. That was it. Works now So folks are happy, and I'm off to buy some necessary books. Thanks (I remember that from when I first set up a phpbb forum ages ago and had a non-functioning site. If I'd understood the error I might have remembered it.)
  2. Back again with same task but moved on half a step.Trying to redirect to mobile page using php.I assumed the code here would redirect if the match was true, or continue to load the page (index.php) if not. <?php $agent = $_SERVER['HTTP_USER_AGENT']; if(preg_match('/iPhone|Android|Blackberry/i', $agent)){ header("Location: mobile.html"); exit; } ?>But is there some boolean weirdness? I'm getting this error - Warning: Cannot modify header information - headers already sent by (output started at /mysite/index.php:1) in /mysite/index.php on line 4index.php on line 4?(If the match isn't true (not a mobile device) the page (index.php) loads ok.)
  3. Turns out this code didn't work after all. Beats me why. I'll have to use javascript... (But then the viewport meta isn't working on iPhone either. Not having much luck with this mobile site all round!)
  4. Wonder how many other folks find themselves in this the same situation.Interested in learning, say, PHP, but needing to use it now because of things that crop up. Therefore often finding themselves in the situation needing to get quick help and advice from (very kind) people who know, and then implementing their suggestions on the fly before properly understanding how that works. Sure, you learn. In a random sort of way. But not an ideal way of going about it? Nevertheless, is this how most people end up coming at it? Or maybe just getting started? Interested to hear opinions/experiences on this. Could apply to any language, of course. Could it be that this arises because design and development has got so much more demanding, technical, and complicated that where one person might once have done both, now you need two or more. But if you don't have two, then... back to where I started at the top...
  5. Right! Which is what you said... Done. Thanks!
  6. Hmm, that's where I put it, just under the doctype. Is there some reason why something simple like this would not work? -- <?php $agent = $_SERVER['HTTP_USER_AGENT']; if(preg_match('/iPhone|Android|Blackberry/i', $agent)){ header("Location: mobile.html"); exit; } ?> Bearing in mind I have no idea what I'm doing with PHP code! (There is a more complicated version of this, but even this cut-down one isn't working.) Could use JavaScript, but I'd prefer this to work. many thanks. btw, php does run on my server. I have forums working just fine.
  7. Total php noob.Have a simple php useragent sniffer needed to redirect mobile users, etc...Where is best to place the script within the main HTML index file? Top of page? Before head, after it, in the body? Do bots read this script or ignore it?
×
×
  • Create New...