-
AuthorPosts
-
markkusq3po Friend
markkusq3po
- Join date:
- March 2007
- Posts:
- 66
- Downloads:
- 0
- Uploads:
- 6
- Thanks:
- 20
- Thanked:
- 1 times in 1 posts
January 9, 2013 at 1:04 pm #183803Hello,
does somebody know how and where to embed some code for browserswitching like this:
[PHP]<?php
function get_user_browser()
{
$u_agent = $_SERVER[‘HTTP_USER_AGENT’];
$ub = ”;
if(preg_match(‘/MSIE/i’,$u_agent))
{
$ub = “ie”;
}
elseif(preg_match(‘/Firefox/i’,$u_agent))
{
$ub = “firefox”;
}
elseif(preg_match(‘/Safari/i’,$u_agent))
{
$ub = “safari”;
}
elseif(preg_match(‘/Chrome/i’,$u_agent))
{
$ub = “chrome”;
}
elseif(preg_match(‘/Flock/i’,$u_agent))
{
$ub = “flock”;
}
elseif(preg_match(‘/Opera/i’,$u_agent))
{
$ub = “opera”;
}return $ub;
}
?>[/PHP]I tried to insert it in the index.php but just got an error page.
Or does somebody knows something else to get Chrome using a separate css file?Thanks
MarkusNinja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
January 10, 2013 at 3:45 am #479201You can put it here: templates/ja_mero/tpls/blocks/head.php
1 user says Thank You to Ninja Lead for this useful post
markkusq3po Friendmarkkusq3po
- Join date:
- March 2007
- Posts:
- 66
- Downloads:
- 0
- Uploads:
- 6
- Thanks:
- 20
- Thanked:
- 1 times in 1 posts
January 10, 2013 at 11:15 pm #479320Hello Ninja,
great, that works so far.
Do you have a little additional hint for me?I added this code too now after that first example code:
$browser = get_user_browser();
if($browser == “chrome”){
<link href=”<?php echo T3V3_TEMPLATE_URL ?>/css/custom_chrome.css” rel=”stylesheet” />
}but though this code is still inside the head the following output is rendered on the front page:
$browser = get_user_browser(); if($browser == “chrome”){ }
do you have a solution how i can hide that?
Thanks Markus
Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
January 11, 2013 at 2:00 am #479327<blockquote>Open templates/ja_mero/tpls/blocks/head.php file</blockquote>
You add this code below
<?php
$u_agent = $_SERVER['HTTP_USER_AGENT'];
if(preg_match('/Chrome/i',$u_agent)):
?>
<link href="<?php echo JURI::base(true) ?>/templates/ja_mero/css/custom_chrome.css" rel="stylesheet" />
<?php
endif;
?>
With this is new path file: templates/ja_mero/css/custom_chrome.css
Front
<?php
// Add T3v3 Basic head
$this->addHead();
?>
2 users say Thank You to Ninja Lead for this useful post
markkusq3po Friendmarkkusq3po
- Join date:
- March 2007
- Posts:
- 66
- Downloads:
- 0
- Uploads:
- 6
- Thanks:
- 20
- Thanked:
- 1 times in 1 posts
January 11, 2013 at 11:06 am #479388Hey, that works. This is more than great.
Thousand thanks, you’re in the supporter heaven for me 😉
Markus -
AuthorPosts
This topic contains 5 replies, has 2 voices, and was last updated by markkusq3po 11 years, 11 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum