PDA

View Full Version : page 1,2,3,4


mrdeleigh
12-07-2006, 08:28 PM
Hi
I got this code below that I'm using in a blog, and as you can see its limited to 25 how do i put a page 1,2,3,4 ect on to this
thanks
mrdeleigh


if(get_param("search_box") == "")

{ $strLatestVideos = '

<table cellspacing=1 cellpadding=0>

<tr>

<td class="right_block_table_first_TD" colspan="2">

&nbsp;LATEST VIDEOS

</td>

</tr>

';

$tableVideos = DataTable_Query("

SELECT author_image, date, ".$DBprefix."weblog.user, title, ".$DBprefix."notes.id , ".$DBprefix."notes.video

FROM ".$DBprefix."notes,".$DBprefix."weblog,".$DBprefix."admin_users WHERE ".$DBprefix."notes.user=".$DBprefix."weblog.user

AND ".$DBprefix."notes.user=".$DBprefix."admin_users.username

AND blog_active=1

AND category_id<>-1

".($SHOW_ONLY_NOTES_WITH_PHOTO?"AND author_image<>0":"")."

AND active='YES'

AND show_video=1

AND video<>''

AND

(".$DBprefix."notes.title LIKE '%".get_param("search_box")."%'

OR

".$DBprefix."notes.html LIKE '%".get_param("search_box")."%'

OR

".$DBprefix."notes.user LIKE '%".get_param("search_box")."%'

)

ORDER BY date DESC LIMIT 0,25");

}



$bColor = true;

$iCounter = 1;

while($arrLastBlog = mysql_fetch_array($tableVideos))

{

if(trim($arrLastBlog["title"]) == "")

{

continue;

}



if($iCounter > $NUMBER_LATEST_NOTES)

{

break;

}



if($arrLastBlog["author_image"] > 1)

{

$author = "<a href='http://".BlogUrl($arrLastBlog["user"])."' target=_blank>";



if($USE_GD)

{

$author .= "<img src=\"thumbnail.php?id=". $arrLastBlog["author_image"]."&w=45&h=60\" width=45 height=60 border=0>";

}

else

{

$author .= "<img src=\"image.php?id=". $arrLastBlog["author_image"]."&w=45&h=60\" width=45 height=60 border=0>";

}



$author .= "</a>";

}

else

{

$author = "<img src=ADMIN/images/no_pic.gif width=45 height=60>";

}



if($arrLastBlog["user"] == "admin")

{

$strBlogger = '<font color=#d68449><b>'.strtoupper($arrLastBlog["user"]).'</b></font>';

}

else

{

$strBlogger = ''.$arrLastBlog["user"].'';

}

echo '







<tr bgcolor='.($bColor?'#ffffff':'#FAF9DA').'>



<td width="296"><a href="'.CreateLink4($arrLastBlog["user"],'note/'.$arrLastBlog["id"],$arrLastBlog["title"]).'" target=_blank>'.stripslashes($arrLastBlog["title"]).'</a></td>

<td width="99"><a href="http://'.BlogUrl($arrLastBlog["user"]).'" target=_blank>'.$strBlogger.'</a></td>

<td width=52><a href="http://'.$BLOG_DOMAIN.'/blog.php?user='.$arrLastBlog['user'].'&note='.$arrLastBlog['id'].'&play=1" target="_blank"><img src="grab.php?id='.$arrLastBlog["video"].'" width="135" height="90" border="0"></a>

</td>

</tr>

';



$iCounter++;



$bColor = !$bColor;

}


$strLatestVideos .= '

Linark
12-07-2006, 09:10 PM
Basically you will need to divide the total number of articles by the default number you want per page then run it through a loop.

so if you want 2 per page and you have 24 articles then you will need to have 12 pages.

mrdeleigh
12-07-2006, 09:12 PM
I want to be able to take away the limit so there can be as many blogs as i want but for it to limit the page by 25

Linark
12-07-2006, 09:27 PM
Change:
ORDER BY date DESC LIMIT 0,25");
To:
ORDER BY date DESC");

mrdeleigh
12-07-2006, 09:47 PM
great

but then how do i make it so i can have page 1,2,3,4 next ect....

thanks for the help