use start
attribute
<ol start="6">
<li>anything</li>
</ol>
or you can use css (multiple column property) applied on one ordered list
Question
I need to make output like this above, but how to add numbers , i can do with < ol > but its not what i need, < ol > tag give me different order.. any idea how to make this and add number before links?
1. Site.com 6. Site.com
2. Site.com 7. Site.com
3. Site.com 8. Site.com
4. Site.com 9. Site.com
5. Site.com 10. Site.com
Here is php code
<?
$list = $my_db->fetch("SELECT " . MY_PREFIX . "list.id, name,address, in_hits, out_hits FROM " . MY_PREFIX . "list LEFT JOIN " . MY_PREFIX . "sites ON " . MY_PREFIX . "list.id=" . MY_PREFIX . "sites.id WHERE status >0 AND status <3 ORDER BY in_hits DESC LIMIT 9");
$count = 1;
echo "<ul>";
foreach($list as $site) {;?>
<li><a href="<?php echo "/out.php?url=" . $site["address"];?>" target="_blank" rel="nofollow" title="<?php echo htmlentities(stripslashes($site["name"]));?>"><?php echo htmlentities(stripslashes($site["name"]));?></a></li>
<?
if ($count == 5) {echo "</ul><ul>";}
$count++;
}
echo "</ul>";
?>
Solution
use start
attribute
<ol start="6">
<li>anything</li>
</ol>
or you can use css (multiple column property) applied on one ordered list
OTHER TIPS
How about use some counter:
<?
$list = $my_db->fetch("SELECT " . MY_PREFIX . "list.id, name,address, in_hits, out_hits FROM " . MY_PREFIX . "list LEFT JOIN " . MY_PREFIX . "sites ON " . MY_PREFIX . "list.id=" . MY_PREFIX . "sites.id WHERE status >0 AND status <3 ORDER BY in_hits DESC LIMIT 9");
$count = 1;
echo "<ul>";
foreach($list as $site) {;?>
<li><a href="<?php echo "/out.php?url=" . $site["address"];?>" target="_blank" rel="nofollow" title="<?php echo htmlentities(stripslashes($site["name"]));?>"><?php echo $count ?>. <?php echo htmlentities(stripslashes($site["name"]));?></a></li>
<?
if ($count % 5 == 0) {echo "</ul><ul>";}
$count++;
}
echo "</ul>";
?>
And I also changed the line if ($count == 5)
to if ($count % 5 == 0)
. So every 5th row will start new list.
try something like
foreach($list as $site) {;?>
<li><a href="<?php echo "/out.php?url=" . $site["address"];?>" target="_blank" rel="nofollow" title="<?php echo htmlentities(stripslashes($site["name"]));?>">
<?php
$i=1;
$j=6
if(count<=5){
echo .$i.'.'.htmlentities(stripslashes($site["name"]));$i++;
}else{
echo .$j.'.'.htmlentities(stripslashes($site["name"]));$j++;
}
?>
</a></li>
rest code remains same