Zippyaus Posted May 28, 2008 Share Posted May 28, 2008 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 Link to comment https://forums.phpfreaks.com/topic/107596-solved-n00b-help-with-code-bold-current-page-in-search-results/ Share on other sites More sharing options...
Rebelrebellious Posted May 28, 2008 Share Posted May 28, 2008 <?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. Link to comment https://forums.phpfreaks.com/topic/107596-solved-n00b-help-with-code-bold-current-page-in-search-results/#findComment-551488 Share on other sites More sharing options...
Zippyaus Posted May 29, 2008 Author Share Posted May 29, 2008 Thanks Rebelrebellious That was exactly what I was after and your explanation cleared up a few things for me ... slowly slowly I will get this PHP thanks again for the assistance == equals S Link to comment https://forums.phpfreaks.com/topic/107596-solved-n00b-help-with-code-bold-current-page-in-search-results/#findComment-552288 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.