Jump to content

davery

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

davery's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm sorry forgive my limited knowledge of php, I'm actually still a novice. Could you perhaps explain a little of what I'm supposed to modify. thnx
  2. Its a random to move an element down only on the homepage (sidebar).
  3. Hi, I wanted to know how to link a stylesheet using php specifically for the purpose of loading a different stylesheet when the home page displays. I heard of echoing out the stylesheet but I do not know how. Any help would be appreciated.
  4. I tried the white-space property but still no luck.
  5. Yes its javascript related, it changes every few seconds to display another feed, one by one.
  6. Greetings, I have a website which has an RSS feed of about 5 posts that appear one by one (the javascript) in a div element. I'm using the default wordpress rss widget with the option "show date" checked. The date is shown outside the div element. Here is the mess: [attachment deleted by admin]
  7. The problem lies within Firefox. Theres a form on the website that is aligned completely off the page in Firefox. In Chrome, its aligned within the space that it should be. Its the same code, just different browsers. Im using Firefox 5.0.1 btw.
  8. What I need is actually not a stylesheet but a php file. How would I link to a php file inside of php?
  9. Yes!! It worked! Thank you......Now instead of the "hello world", I wanna display a stylesheet that will show in Firefox.
  10. Greetings, I'm using the get_browser function that can determine what browser the user is using. The following code will display the name, version and platform of the browser: <?php function getBrowser() { $u_agent = $_SERVER['HTTP_USER_AGENT']; $bname = 'Unknown'; $platform = 'Unknown'; $version= ""; //First get the platform? if (preg_match('/linux/i', $u_agent)) { $platform = 'linux'; } elseif (preg_match('/macintosh|mac os x/i', $u_agent)) { $platform = 'mac'; } elseif (preg_match('/windows|win32/i', $u_agent)) { $platform = 'windows'; } // Next get the name of the useragent yes seperately and for good reason if(preg_match('/MSIE/i',$u_agent) && !preg_match('/Opera/i',$u_agent)) { $bname = 'Internet Explorer'; $ub = "MSIE"; } elseif(preg_match('/Firefox/i',$u_agent)) { $bname = 'Mozilla Firefox'; $ub = "Firefox"; } elseif(preg_match('/Chrome/i',$u_agent)) { $bname = 'Google Chrome'; $ub = "Chrome"; } elseif(preg_match('/Safari/i',$u_agent)) { $bname = 'Apple Safari'; $ub = "Safari"; } elseif(preg_match('/Opera/i',$u_agent)) { $bname = 'Opera'; $ub = "Opera"; } elseif(preg_match('/Netscape/i',$u_agent)) { $bname = 'Netscape'; $ub = "Netscape"; } // finally get the correct version number $known = array('Version', $ub, 'other'); $pattern = '#(?<browser>' . join('|', $known) . ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#'; if (!preg_match_all($pattern, $u_agent, $matches)) { // we have no matching number just continue } // see how many we have $i = count($matches['browser']); if ($i != 1) { //we will have two since we are not using 'other' argument yet //see if version is before or after the name if (strripos($u_agent,"Version") < strripos($u_agent,$ub)){ $version= $matches['version'][0]; } else { $version= $matches['version'][1]; } } else { $version= $matches['version'][0]; } // check if we have a number if ($version==null || $version=="") {$version="?";} return array( 'userAgent' => $u_agent, 'name' => $bname, 'version' => $version, 'platform' => $platform, 'pattern' => $pattern ); } // now try it $ua=getBrowser(); $yourbrowser= "Your browser: " . $ua['name'] . " " . $ua['version'] . " on " .$ua['platform'] . " reports: <br >" . $ua['userAgent']; print_r($yourbrowser); ?> I'm trying to add an "if" conditional to say that when the user is using the Mozilla Firefox browser, print the text "Hello World". I just recently tried adding this before the ?> but no luck: if ($yourbrowser == "Mozilla Firefox") { print("Hello World"); } Any help would be greatly appreciated.
×
×
  • 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.