Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP中包含用于DIV的CSS_Php_Css_Html - Fatal编程技术网

在PHP中包含用于DIV的CSS

在PHP中包含用于DIV的CSS,php,css,html,Php,Css,Html,有人能帮我把上面的代码转换成PHP吗? 我的意思是,如果我有条件,如何在40多个DIV中设置CSS 谢谢好吧,您的原始代码一开始就毫无意义,因为一半声明的变量甚至没有被使用。此外,我也不明白为什么要将前端代码转换成这样的服务器端代码,php是而不是正确的方法 .imgBox { background:url(booth_top_images/5X20TOP.jpg) no-repeat; width:900px; height:225px; } if(bootshizerglobal==3)

有人能帮我把上面的代码转换成PHP吗? 我的意思是,如果我有条件,如何在40多个DIV中设置CSS


谢谢

好吧,您的原始代码一开始就毫无意义,因为一半声明的变量甚至没有被使用。此外,我也不明白为什么要将前端代码转换成这样的服务器端代码,
php
而不是正确的方法

.imgBox
{
background:url(booth_top_images/5X20TOP.jpg) no-repeat; 
width:900px;
height:225px;
}
if(bootshizerglobal==3){
$cellWidth='112px';
$cellHeight='52px';
$innerDivElectricTop='41px';
$innerDivElectricLeft='110px';
$backgroundImage='url(booth_top_images/5X20TOP.jpg)';

$divCode='将javascript转换为php?它们的工作方式都不同。服务器!=browser您没有使用
cellWidth
cellHeight
…如果您真的愿意,可以在javascript中使用-statement。比使用各种
If
-语句更好…感谢它对me@Dhar没问题,很乐意帮忙。
.imgBox
{
background:url(booth_top_images/5X20TOP.jpg) no-repeat; 
width:900px;
height:225px;
}
if(boothsizerGlobal ==  3){
    $cellWidth = '112px';
    $cellHeight = '52px';
    $innerDivElectricTop = '41px'; 
    $innerDivElectricLeft =  '110px';    
    $backgroundImage = 'url(booth_top_images/5X20TOP.jpg)';

    $divCode = '<div style="width: ' . $cellWidth . '; height: ' . $cellHeight . '; "';
    return $divCode

}