How to display part of PHP function in one line?

Jacob

New member
I have this PHP Code:
</tbody>
<tfoot>
<tr>
<td class="rounded-foot-right"><em>
<?php
for($i = 1; $i <= $total; $i++) {
$pagination = $i;
if($page != $i)
$pagination = "<div id=\"text_pagination\"><a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$pagination</a></div>";
echo $pagination;
}
?>
</em></td>
<td colspan="3" class="rounded-foot-left">Â*</td>
</tr>
</tfoot>
And i have this CSS:
#rounded-corner tfoot td.rounded-foot-right {
background: #e8edff url(../img/table/botright.png) right bottom no-repeat;
text-align: center;
white-space: nowrap;
overflow: auto;
direction: rtl;
}

This is pagination, and i want it to display on the same line. But that's what i get: http://img369.imageshack.us/i/46149977.png/
$pagination = " <p> <a href= \"". $_SERVER['PHP_SELF']. "?page=$i\">$pagination</a></p>";
I can't create another function just because this code is already connected with other stuff in one function. So it will be to difficult to separate the pagination to another function.
I sure the problem can be solved by CSS or some html in php. But i can't find a solution.
A guy with too much time - Hmmm...i understood you. But do you think that it cause a problem with single lines? I thought it's in CSS.
But thanks, i will code better loop. ;)
 
Look at the flow of logic:
$pagination = $i; // this is a numeric value
if($page != $i) // if $page does not equal $i
// change $pagination to a link
echo $pagination; // print the value of $pagination

Pretty much what's happening is that $page is never equalling $i so it's never changing $pagination away from $i

[Edit] Uness it's working but it'll display the links as a numeric value as you're setting $pagination to equal a link with $pagination as the value to show. As $pagination is already a numeric value to begin with, it'll display the number regardless. So you're going to end up with either a blank numeric value or a link with a numeric value.
 
Back
Top