I am facing a problem . In front page of my website i got following warning: Deprecated: Function ereg() is deprecated. Yesterday it was working right. I have searched in google and got that we have to substitue with "preg_match". I did it but problem is same.
Here is the code:
<?php
/*CSS fixed for some browser*/
$browser=$_SERVER['HTTP_USER_AGENT'];
if(ereg('MSIE 6', $browser)) {
// hack IE here
?>
<link href="<?php echo JURI::base();?>/templates/crnatoday/templates/template_ie6.css" rel="stylesheet" type="text/css" />
<?
} else if(ereg('MSIE 7', $browser)) {
// hack IE here
?>
<link href="<?php echo JURI::base();?>/templates/crnatoday/templates/template_ie7.css" rel="stylesheet" type="text/css" />
<?
} else if(ereg('Safari/([0-9].[0-9]{1,2})', $browser)){
// hack safari here
?>
<link href="<?php echo JURI::base();?>/templates/crnatoday/templates/safari.css" rel="stylesheet" type="text/css" />
<?
} else if(ereg('Firefox/2', $browser) && ereg('Windows', $browser)) {
// hack firefox2
?>
<link href="<?php echo JURI::base();?>/templates/crnatoday/templates/firefox2_win.css" rel="stylesheet" type="text/css" />
<?php
} else if(ereg('Firefox', $browser) && ereg('Mac', $browser)) {
// hack firefox2
?>
<link href="<?php echo JURI::base();?>/templates/crnatoday/templates/firefox_mac.css" rel="stylesheet" type="text/css" />
<?php
} else if(ereg('Mozilla/([0-9].[0-9]{1,2})', $browser)) {
// hack mozilla here
} else {
// hack other here
}
?>
Please help to sought it out.
Your template was developed for Joomla 1.5 which supports PHP 4.3.10+. You host, has most likely upgraded the server PHP version from 5.2 or lower, to 5.3 or above.
If your template has to have separate custom CSS files for each browser, then it is a poorly made template. My suggestion would simply be to remove all that code and simply load 1 single CSS file.
If you really need to keeps these hacks (hopefully not), then have a look at the following which gives a little insight on how to convert ereg to preg_match:
http://www.devthought.com/2009/06/09/fix-ereg-is-deprecated-errors-in-php-53/
Related
<?php if($_COOKIE['lang'] != 'en') echo '<link rel="stylesheet" href="css/'.$_COOKIE['lang'].'.css"/>'; ?>
With this above script you get the stylesheet for the language that is selected.
Like if you select France you get the stylesheet fr.css
But now I want the same for IE so I thought something like this.
<?php if($_COOKIE['lang'] != 'en') echo '<link rel="stylesheet" href="css/'.$_COOKIE['lang'].'ie.css"/>'; ?>
So now when you click on France it also opens frie.css
But what do I write in here to make it only for IE
<!--[if IE]><style>#import url('/css/ie.css');</style><![endif]-->
Thanks!
<?php
if($_COOKIE['lang'] != 'en'){
printf('<!--[if IE]><style>#import url(\'/css/%sie.css\');</style><![endif]-->', $_COOKIE['lang']);
}
?>
This is what you need to write. You can also check in PHP headers if browser is Internet Explorer.
You can use $_SERVER['HTTP_USER_AGENT'] or get_browser() function to check it in PHP.
You can use this :
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="all-ie-only.css" />
<![endif]-->
You can refer to below line :
https://css-tricks.com/how-to-create-an-ie-only-stylesheet/
I have developed a PHP application and I am using ajax in it. I have a strange issue that when I use a code in another file it runs nice but when the code runs, some html tag is produced and in one location some empty string is generated. I don't know why this empty text is echo-ed between the tags.
url of pic: picture of issue
this is my code inside the ajax file:
<script language="javascript" src="<?php echo $baseurl; ?>js/app.js"></script>
<link rel="stylesheet" href="<?php echo $baseurl; ?>css/style.css">
<link rel="stylesheet" href="<?php echo $baseurl; ?>css/grid.css">
<link rel="stylesheet" href="<?php echo $baseurl; ?>css/layout.css">
<link rel="stylesheet" href="<?php echo $baseurl; ?>css/elements.css">
<link rel="stylesheet" href="<?php echo $baseurl; ?>css/forms.css">
<link rel="stylesheet" href="<?php echo $baseurl; ?>css/typographics.css">
<link rel="stylesheet" href="<?php echo $baseurl; ?>css/ie-fixes.css">
<?php //دریافت درخواست های کوئری استرینگ
if(!empty($_GET['mBLID'])) $mBLID = $_GET['mBLID'];
if(!empty($_GET['ctID'])) $ctID = $_GET['ctID'];
if(!empty($_GET['crID'])) $crID=$_GET['crID'];
if(!empty($_GET['loadingID'])) $loadingID = $_GET['loadingID'];
if(!empty($_GET['borderTitle'])) $borderTitle=$_GET['borderTitle'];
if(!empty($_GET['value'])) $receivedValue = $_GET['value'];
...?>
I totally go crazy for this problem because it creates an empty space between the input and makes it ugly
You should not end a PHP file with ?>. The following newline (as added by editors) is then "printed" to the client
Just remove the closing ?>, and PHP will end processing the file automatically.
Also see here: Why would one omit the close tag?
i am using transposh to translate my website from English to Arabic but when i switch language to Arabic it switches the style.css and it reverse the layout of my website leading to a mess, so i made a new style.css which works with the Arabic version very well but now i don't know how to link them together i mean i want to know how to make it switch the css file when it switches the language.
i tried this code but it didn't work
<?php if(MY_CUR_LANG == 'en'){?>
<link rel="stylesheet" href="http://localhost/wordpress/wp-content/themes/style.css" type="text/css" media="screen" />
<?php }elseif(MY_CUR_LANG == 'ar'){?>
<link rel="stylesheet" href="http://localhost/wordpress/wp-content/themes/arabic.css" type="text/css" media="screen" />
<?php } ?>
You cannot jump in and out php code. Try
<?php
if(MY_CUR_LANG == 'en'){
echo'<link rel="stylesheet" href="http://localhost/wordpress/wp-content/themes/style.css" type="text/css" media="screen" />';
}elseif(MY_CUR_LANG == 'ar'){
echo'<link rel="stylesheet" href="http://localhost/wordpress/wp-content/themes/arabic.css" type="text/css" media="screen" />';
}
?>
I have a index.php file which loads (require) 2 different files based on a condition.
Visiting this link will cause;
mysite.com/index.php will load stats.php (require("stats.php");)
Visiting this link will cause;
mysite.com/index.php?auth="jgbsbsbasm" will load encry.php (require("stats_encry.php");)
Done with this code:
<?php
if(isset($_GET['auth'])) require("stats.php");
else require("stats_encry.php");
?>
This works fine. Now my question is; I have a CSS file in the header as static;
<link rel="stylesheet" href="cv.css">
What I want is now to load cv.css file for stats.php and cv1.css for stats_encry.php respectively.
How do I do this?
In your header replace
<link rel="stylesheet" href="cv.css">
with
<?php if(isset($_GET['auth'])){ ?>
<link rel="stylesheet" href="cv.css">
<?php } else { ?>
<link rel="stylesheet" href="cv1.css">
<?php } ?>
You can use this like below syntax
<?php
if(isset($_GET['auth'])){
echo '<link rel="stylesheet" href="cv.css">';
} else {
echo '<link rel="stylesheet" href="cv1.css">';
}
?>
I am using multiple stylesheets and need the pages to differ based on category.
I added the following to my header.php, but shows base theme`s single entry template. Any ideas?
<?php if (is_category('20')) { ?>
<link rel="stylesheet" type="text/css" href="wp-content/themes/tanzaku/style.css" />
<?php } else {?>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/style.css" />
<?php } ?>
I am using the same theme as these sites, but I use two themes on my site compared to these.
http://marioortega.net/
http://atelier6.co.uk/
When you click one of the thumbnails, the single ends up on top and the thumbnails at the bottom.
All:
Thank you for looking into this. In order for me to get this to work, the problem was actually multiple single.php files. This can be solved by having your single.php look like this,
<?php
$post = $wp_query->post;
if ( in_category('20') ) {
include(TEMPLATEPATH . '/single1.php');
} else {
include(TEMPLATEPATH . '/single2.php');
}
?>
I have also edited the question for other people looking for this answer.
Shouldn't you be using echo statement to put the link into your page.
<?php
if (is_category('20')) {
echo '<link rel="stylesheet" type="text/css" href="wp-content/themes/tanzaku/style.css" />';
}
else {
echo '<link rel="stylesheet" type="text/css" href="'.bloginfo('template_url').'/style.css" />';
}
?>