friends any ideas how can i change background color of a page every time a page refreshes , but i want it for lavalair script
change background color with page refresh (lavalair)
Collapse
X
-
PHP Code:session_start();
if(!isset($_SESSION['color'])) $_SESSION['color'] = 'red';
$color = $_SESSION['color'];
echo '<body bgcolor="'.$color.'">';
if($color=="red") $_SESSION['color'] = 'blue';
if($color=="blue") $_SESSION['color'] = 'yellow';
if($color=="yellow") $_SESSION['color'] = 'red';
//etc
-
can it b done using cssOriginally posted by something else View PostPHP Code:session_start();
if(!isset($_SESSION['color'])) $_SESSION['color'] = 'red';
$color = $_SESSION['color'];
echo '<body bgcolor="'.$color.'">';
if($color=="red") $_SESSION['color'] = 'blue';
if($color=="blue") $_SESSION['color'] = 'yellow';
if($color=="yellow") $_SESSION['color'] = 'red';
//etc
Comment
-
change it to style.php
PHP Code:<?php
session_start();
if(!isset($_SESSION['color'])) $_SESSION['color'] = 'red';
$color = $_SESSION['color'];
?>
body {background-color:<?=$color?>;}
<?
if($color=="red") $_SESSION['color'] = 'blue';
if($color=="blue") $_SESSION['color'] = 'yellow';
if($color=="yellow") $_SESSION['color'] = 'red';
?>
Comment
-
if i'd use this, i'd use this way, as i hate short open tags LOLOriginally posted by something else View Postchange it to style.php
PHP Code:<?php
session_start();
if(!isset($_SESSION['color'])) $_SESSION['color'] = 'red';
$color = $_SESSION['color'];
?>
body {background-color:<?=$color?>;}
<?
if($color=="red") $_SESSION['color'] = 'blue';
if($color=="blue") $_SESSION['color'] = 'yellow';
if($color=="yellow") $_SESSION['color'] = 'red';
?>
PHP Code:<?php
session_start();
if(!isset($_SESSION['color'])) $_SESSION['color'] = 'red';
$color = $_SESSION['color'];
?>
body {background-color:<?php echo $color; ?>;}
<?php
if($color=="red") $_SESSION['color'] = 'blue';
if($color=="blue") $_SESSION['color'] = 'yellow';
if($color=="yellow") $_SESSION['color'] = 'red';
?>Last edited by metulj; 21.04.12, 13:19.キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ â“â“¡â“” â“ⓑⓛⓔ ⓣⓞ â“—â“”â“â“¡ !
ιη тнєσÑу, тнє ÏÑα¢тι¢є ιѕ α Ñєѕυℓт σƒ тнє тнєσÑу, вυт ιη ÏÑα¢тι¢є ιѕ тнє σÏÏσѕιтє.
Comment
-
can you explain in brief (uses).Originally posted by metulj View Posti i'd use this, i'd use this way, as i hate short open tags LOL
PHP Code:<?php
session_start();
if(!isset($_SESSION['color'])) $_SESSION['color'] = 'red';
$color = $_SESSION['color'];
?>
body {background-color:<?php echo $color; ?>;}
<?php
if($color=="red") $_SESSION['color'] = 'blue';
if($color=="blue") $_SESSION['color'] = 'yellow';
if($color=="yellow") $_SESSION['color'] = 'red';
?>
Comment
-
thats my css in core.php , i want to change the background color of boxedContent on page refresh , m not able to use above given codes bro , when i tried it only used to show background color red , on refresh yellow , next on refresh i get blue , but in words it showed , colors didnt changePHP Code:* {
margin: 0;
padding: 0;
}
.alignleft {
float: left;
}
.alignright {
float: right;
}
.boxed {
width: 99%;
margin-bottom: 3px;
border: 1px solid #000000;
}
.boxedTitle {
height: 18px;
padding: 0 0 0 2px;
background: ".$thm[1]." url(images/".$thm[2].") repeat-x;
}
.boxedTitleText {
font-size: 11px;
color: ".$thm[3].";
}
.boxedContent {
padding: 2px 2px 2px 2px;
background: ".$thm[4].";
font-size: $fsize;
}
.logo {
padding: 2px 2px 2px 2px;
background: ".$thm[9]." url(images/".$thm[11].") repeat-x;
}
.footer {
width: 100%;
padding: 5px;
background: url(images/".$thm[18].") repeat-x;
}
.gt {border-bottom: 1px solid #A9BF74; 0px 3px 3px;margin:0px 0px 8px; color: silver;}
h1 {
color: #000000;
}
a:visited {
color: ".$thm[6].";
}
a:link {
color: ".$thm[5].";
}
h5 {
height: 30px;
padding: 0 0 0 2px;
background: ".$thm[7]." url(images/".$thm[8].") repeat-x;
color: ".$thm[3].";
}
body {
background: ".$thm[9]." ;
font: normal small Arial, Helvetica, sans-serif, Verdana;
color: ".$thm[10].";
}
.inputText {
background-color: ".$thm[12].";
color: ".$thm[13].";
border: 1px solid ".$thm[14].";
}
.inputButton {
background-color: ".$thm[15].";
color: ".$thm[16].";
border: 1px solid ".$thm[17].";
}
</style>
Last edited by mirror; 21.04.12, 13:25.
Comment
-
well.. as for typing purposeOriginally posted by icedroplet1987 View Postcan you explain in brief (uses).
is ofcourse shorter to type thanPHP Code:<?=
but...PHP Code:<?php echo
short open tag imho isnt really convenient...
let's say you write a script with short tags,
then you move the script to server which original
settings is open_short_tag=off, and you dont have access to php.ini... BAD
which is case on most shared hosts...
but hey.. it could only my imagination..キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ â“â“¡â“” â“ⓑⓛⓔ ⓣⓞ â“—â“”â“â“¡ !
ιη тнєσÑу, тнє ÏÑα¢тι¢є ιѕ α Ñєѕυℓт σƒ тнє тнєσÑу, вυт ιη ÏÑα¢тι¢є ιѕ тнє σÏÏσѕιтє.
Comment
-
Only if your coding style is mixing markup and php, which is not quite efficiently. PHP turns on, php turns off, turns on, turns off, on, off, on off on off...Originally posted by something else View PostI Like php short tag being enabled..... you dont need php.ini can do it via .htacess:
also it reduces echo`s which slow your site down....PHP Code:php_value short_open_tag 1
hence why ori wrote wapdesire v2 all with variables and one echo at the bottom of the page
<!DOCTYPE html PUBLIC "-//WAPFORUM.RS
Comment
-
Originally posted by something else View PostI Like php short tag being enabled..... you dont need php.ini can do it via .htacess:
also it reduces echo`s which slow your site down....PHP Code:php_value short_open_tag 1
hence why ori wrote wapdesire v2 all with variables and one echo at the bottom of the page
interesting and good advice at same time, although i have to say i do prefer full tags, it just looks cleaner
and makes it look like you wanted to go that extra mile lol ;)<?php
include ('Ghost');
if ($Post == true) {
echo '

sigpic
alt='coding-talk.com!!' />';
echo 'Sharing Is Caring!';
} else {
echo '

alt='the username GHOST has been comprimised!' />';
echo 'OMG SOMEBODY HELP ME!!';
}
?>
Comment
-
Depends, take a look at this post http://coding-talk.com/f14/css-editi...510/#post93920 , and imagine all the way short tag for that type of needs but in quantity more than 400 lines for writing and reading, line by line. ;)<!DOCTYPE html PUBLIC "-//WAPFORUM.RS
Comment
-
I love php
<?php=shif();?> or <?php echo shif(); ?> or plain <?php shif(); ?>Code:function include_emulating_short_tags ($viewFile) { // Alternate method for making <?= valid $raw = file_get_contents ($viewFile); $raw = str_replace ('<?=', '<?php echo ', $raw); $html = ''; $phptokens = @token_get_all ($raw); $mode = 'text'; $phpcode = ''; foreach ($phptokens as $ptoken) { if (($mode == 'text') && is_array ($ptoken) && ($ptoken[0] === T_OPEN_TAG)) { $mode = 'php'; continue; } if (($mode == 'php') && is_array ($ptoken) && ($ptoken[0] === T_CLOSE_TAG)) { ob_start(); eval ($phpcode . ';'); $html .= ob_get_contents(); ob_end_clean(); $mode = 'text'; $phpcode = ''; continue; } if ($mode == 'text') { $html .= is_array ($ptoken) ? $ptoken[1] : $ptoken; } else { $phpcode .= is_array ($ptoken) ? $ptoken[1] : $ptoken; } } if (($mode == 'php') && ($phpcode !== '')) { ob_start(); eval ($phpcode); $html .= ob_get_contents(); ob_end_clean(); } return $html; }
Tells PHP whether the short form (<? ?>) of PHP's open tag should be allowed. If you want to use PHP in combination with XML, you can disable this option in order to use <?xml ?> inline. Otherwise, you can print it with PHP, for example: <?php echo '<?xml version="1.0"?>'; ?>. Also, if disabled, you must use the long form of the PHP open tag (<?php ?>).
Note:
This directive also affected the shorthand <?= before PHP 5.4.0, which is identical to <? echo. Use of this shortcut required short_open_tag to be on. Since PHP 5.4.0, <?= is always available.
PHP: Description of core php.ini directives - ManualVisit: Chat4u.mobi - The New Lay Of being a site of your dreams!
Visit: WapMasterz Coming Back Soon!
_______
SCRIPTS FOR SALE BY SUBZERO
Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
_______
Info & Tips
php.net
w3schools.com
Comment
Comment