Jump to content

[SOLVED] n00b .. help with code ... Bold current page in search results


Zippyaus

Recommended Posts

Hi all

 

I have done a lot of searching for this and can't find an answer.  Hopefully it is easy enough for someone to work out or point me in the right direction.

 

I have some code, below, which breaks the number of found records in a search down into pages of 20.  I am trying to highlight by making bold the page that I am currently looking at.

 

for example, if my results page found 60 records, the first 20 records are returned and I have breadcrumbs for 1 | 2 | 3

 

How can I get the If Else to bold the returned value for the current page.

 

$Skipsize is defined at the top of the page as

 

if(isset($_GET['skip'])){ $skipSize=$_GET['skip'];}else{$skipSize='0';}

 

The returned results are coded as

 

<?php
if($pages>'1'){
$i='1';
$x='0';
?>
<a href='?skip=0&Title=<? echo $Title; ?>'><?php echo $i; ?></a>
<?php
while($i<$pages){
$x=$i*$groupSize;
$i++;
echo ' | '
?>
<?php if( $x=$skipSize ) : ?>
<a href='?skip=<?php echo $x; ?>&Title=<?php echo $Title; ?>'><strong><?php echo $i; ?></strong></a>

<?php else : ?>

<a href='?skip=<?php echo $x; ?>&Title=<?php echo $Title; ?>'><?php echo $i; ?></a>


<?php endif; ?>

<?php
}
}
?>

 

Any help would be greatly appreciated.

 

 

Thanks in advance

 

ZP


<?php
if($pages>'1'){
$i='1';
$x='0';



?>

<a href='?skip=0&Title=<?                    //This tag should begin <?php

echo $Title; ?>
'>
<?php echo $i; ?>
</a>

<?php
while($i<$pages){
$x=$i*$groupSize;
$i++;

echo ' | '                        ;                                                         // don't forget this semicolon

?>                                                                                      // it is unnecessary to close this 
<?php                                                                                 // since you open it again right away.

if( $x=$skipSize ) : ?>                                                                                // if you want to test if $x is equal you should use ==     
                                                                                                              // This will get your strong tags working.
    
<a href='?skip=<?php echo $x; ?>&Title=<?php echo $Title; ?>'><strong><?php echo $i; ?></strong></a>

<?php else : ?>

<a href='?skip=<?php echo $x; ?>&Title=<?php echo $Title; ?>'><?php echo $i; ?></a>


<?php endif; ?>

<?php
}
}
?>

 

Apart from that, I recomment seperating your code from your html more. I had a hard time reading that.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.