[英]If (Author) statement in Joomla 1.5
我需要基于PHP的if循环,在Joomla 1.5 HTML中可以在其中插入php代码以查找作者,当我获取该变量时,我可以进行IF语句
例如
if ($author="a") {
echo "This is author a";
}
elseif ($author="b"){
echo "this is author b";
}
elseif ($author="c"){
echo "this is author c";
}
我不知道如何从文章中获取$ author变量(名称)
您应该在if语句中使用==
或===
代替=
例
if ($author == "a") {
echo "This is author a";
}
elseif ($author == "b") {
echo "this is author b";
}
elseif ($author == "c") {
echo "this is author c";
}
或使用开关
switch ($author) {
case "a" :
echo "This is author a";
break;
case "b" :
echo "This is author a";
break;
case "c" :
echo "This is author a";
break;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.