I have a situation where a page was working fine but my boss has asked me to change it from a table based display to a div based display and at the same time, move away from having them in lines of three, to just one line per item.
Like I said its working, but for the life of me I cant get it to just line up neatly 1 by one down the page, can somebody help me with it please.
Here is the code that I havent touched as it seems to be doing what is needed.
PHP Code:$mPageSize = @$HTTP_POST_VARS["txtPageSize"];
if ((!isset($mPageSize))||intval($mPageSize)==0)
{
// $mPageSize = @$HTTP_GET_VARS["pagesize"];
$mPageSize = $pagesize;
if ((!isset($mPageSize))||intval($mPageSize)==0)
$mPageSize = 9;
}
$mUrl = $PHP_SELF."?pagesize=".$mPageSize.$mConQry_Str;
//$mAbsolutePage = @$HTTP_GET_VARS["absolutepage"];
$mAbsolutePage = $absolutepage;
if (!isset($mAbsolutePage))
{ // Set $mOffset and absolutepage if not set
$mAbsolutePage = 1;
$mOffset = 0;
} else {
$mOffset = ( $mAbsolutePage - 1 ) * $mPageSize ;
}
$mResult = mysql_query($mQry) or ("Wrong Select Query");
// $mResult = mysql_query($mQry) or die(mysql_error());
$mRecordCount = mysql_num_rows($mResult);
$mPageCount = intval($mRecordCount / $mPageSize);
if ($mRecordCount % $mPageSize ) $mPageCount++;
if ($mAbsolutePage>$mPageCount) $mAbsolutePage=$mPageCount;
$mOffset = ( $mAbsolutePage - 1 ) * $mPageSize ;
//}
if ($mRecordCount == 0)
{
}
if($mOffset<0)
{
$mOffset=0;
}
$mQry .= " LIMIT $mOffset, $mPageSize "; // Get record set = $mPageSize every time
$mRes = mysql_query($mQry);
//$mResult = mysql_query($mQry);
if ($mAbsolutePage == 1)
{
$mPag1 = $mAbsolutePage;
//echo $mAbsolutePage;
}
else
{
$mPag1 = (($mAbsolutePage - 1) * $mPageSize) + 1;
}
$mPag2 = $mPag1 + ($mPageSize - 1);
if ($mPag2 > $mRecordCount)
$mPag2 = $mRecordCount;
//echo $mAbsolutePage;
// Page Navigator code
$result=mysql_query($mQry) or die("Wrong Query");
$records=mysql_num_rows($result);
But below is the code that at one stage was all ordered in a table, which I ripped the code out to try and order it by div's and instead of ordering itself 3 in a row, I wont it 1 per row(line).
I didnt write or design this stuff, this was given to me to sort out, but its all over the pkace and i cant get my head around it.Code:<div style="position:relative; width:100%; background-color:#BF1E2E; top:-9px; padding-bottom:5px;"> <? if(($i%0)==0 || $i==0 ){ ?> <? for($j=3; $j<=$cnt; $j++) { $morevalue=true; $rows=mysql_fetch_assoc($result) or $morevalue=false; ?> <? if($morevalue){ if(is_file("./foxglove/".$rows['foto1'])) { imgresize("./foxglove/$rows[foto1]"); ?> <a href="hotel.php?Id_Hot=<?=$rows['hotel_id']?>&Id=<?=$hlist?>&selectCountry=<?=$selectCountry?>&selectRegion=<?=$rows['region_id']?>" class="bodySmall1"><img class="HomeFeaturedImages" src="./foxglove/<?=$rows['foto1']?>" alt="<?=$rows['hotel_name']?> - <?=$rows['country']?> Hotels & Apartments" width="155" height="155" border="0" align="bottom" style="border:#fff solid 1px;"/></a> <? }} ?> <span style="color:#FFF; font-size:16px; font-weight:bold;"> <? if($morevalue){ ?> <?=$rows['hotel_name']?> <? } ?> </span><br/> <? if($morevalue){ ?> <?php $int=strlen($rows['star_rating']); if($int>0) { $k=0; while($k<$int) { ?> <img src='images/Red Star.png' alt="" width="8" height="9" border='0' /> <?php $k++; } } ?> <? } ?> <br/> <span style="color:#F95A00; top:8px; position:relative; font-size:16px; font-weight:bold;"> <? if($morevalue){ ?> <?=$rows['country']?> <? } ?> </span><br/> <span> <? if($morevalue){ ?><br/> <a href="hotel.php?Id_Hot=<?=$rows['hotel_id']?>&Id=<?=$hlist?>&selectCountry=<?=$selectCountry?>&selectRegion=<?=$rows['region_id']?>" style="color:#FFFFFF;">More Info</a> <? } ?> </span> <? if($morevalue){ ?> <? } ?> <? if(($j==1||$j==2) && $morevalue) { ?> <? } ?> <? } ?> <? } ?> </div> <? } ?> <? } else { ?> <p class="style6"> <?php if($hlist==4 or $hlist==10 or $hlist==11 or $hlist==12 or $hlist==13 or $hlist==14){ ?> <span class="style9">Sorry, there are currently no VIA Cristal properties that match your search criteria.</span> <?php }else{ ?> <span class="style9">Sorry, there are currently no Hotels that match your search criteria.</span> <? } ?> </p> <? } ?> <div align="center" style="background-image:url(images/result_Bottom_Orange.jpg); position:relative; width:960px; height:81px;" > <font face="tahoma" class="style5"> <img src="images/Orange arrow.png" alt="Link Arrow" width="20" height="20" style="position:relative; margin-top:30px; vertical-align:bottom;" /> <a href="index.php" style="color:#FFFFFF; text-decoration:none;"> Back to search</a> <br/> <br/> <br/> </font> </div> </div>



Reply With Quote



Bookmarks