Php 将类或样式名放在何处
我想为分页的底部添加三个类,其中显示页码,我在PHP中使用了它,但我不知道在PHP echo中将类名放在哪里才能工作。。。因为我有错误Php 将类或样式名放在何处,php,class,styles,echo,Php,Class,Styles,Echo,我想为分页的底部添加三个类,其中显示页码,我在PHP中使用了它,但我不知道在PHP echo中将类名放在哪里才能工作。。。因为我有错误 class="box_one" for ... << Prev Page class="box_two" for ... echo $thenumrows or $i class= "box_three" ... Next Page >> class=“box\u one”用于…> 这是代码 <
class="box_one" for ... << Prev Page
class="box_two" for ... echo $thenumrows or $i
class= "box_three" ... Next Page >>
class=“box\u one”用于…>
这是代码
<?php
if ($thenumrows != "")
{
echo "<br>";
if ($thecurrentpage > 1)
echo "<a href='". $_SERVER['PHP_SELF'] . "?cat= ". $theselectedcat ."&rows= "
. $thenumrows ."&page=". $thepreviouspage ."'>
<< Prev Page </a> "; for ($i=1;$i<=$totalpages;$i++)
{
if ($i == $thecurrentpage)
echo $i ." ";
else
echo "<a href='". $_SERVER['PHP_SELF'] ."?cat=". $theselectedcat ."&rows=".
$thenumrows ."&page=". $i ."'>$i</a> ";
}
if ($thecurrentpage < $totalpages)
echo "<a href='". $_SERVER['PHP_SELF'] ."?cat=". $theselectedcat ."&rows=".
$thenumrows ."&page=". $thenextpage ."'>Next Page >></a> ";
}
?>
请帮忙,谢谢
我必须清理你的代码。这些类被添加到
a
-标记中:
if ($thenumrows != "") {
echo "<br />";
// Back
if ($thecurrentpage > 1) {
echo '<a class="box_one" href="'. $_SERVER['PHP_SELF'] . '?cat=' . $theselectedcat . '&rows=' . $thenumrows . '&page=' . $thepreviouspage . '"><< Prev Page</a> ';
}
// Paginating
for ($i=1; $i<=$totalpages; $i++) {
if ($i == $thecurrentpage) {
echo '<span class="box_two">' . $i .'</span> ';
}
else {
echo '<a class="box_two" href="' . $_SERVER['PHP_SELF'] . '?cat=' . $theselectedcat . '&rows=' . $thenumrows . '&page=' . $i . '">' . $i . '</a> ';
}
}
// Next
if ($thecurrentpage < $totalpages) {
echo '<a class="box_three" href="' . $_SERVER['PHP_SELF'] . '?cat=' . $theselectedcat . '&rows=' . $thenumrows . '&page=' . $thenextpage .'">Next Page >></a> ';
}
}
?>
if($thenumrows!=“”){
回声“
”;
//背
如果($thecurrentpage>1){
回声';
}
}
//下一个
如果($CurrentPage<$totalpages){
回声';
}
}
?>
感谢您的帮助,有一个小问题,我几乎不知道为什么会出现问题,当前页面显示的数字工作正常,但其他数字或预览数字显示的是所有($i)像这样>我试图弄清楚为什么会这样显示。在添加类之前工作正常,但不是这个。。。任何想法…@user3417953-已修复。非常感谢您的帮助。非常好,我确信我从中学到了一些东西。再次感谢你的帮助。