我需要基于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变量(名称)答案 0 :(得分:0)
您应该在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;
}