I have this php code to see last results of the post, but I have a way to be able to paginate the results, eg, "1-2-3-4 preview << - >> next".
This is the code that I have to reformat:
Quote
<?
echo '<!--[if lt IE 7]>
<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE7.js" type="text/javascript"></script>
<![endif]-->
<style type="text/css">
</style>
';
echo '
<style type="text/css">
<!--
body{background-image : url(06.jpg);
background-repeat : repeat ;
background-attachment : fixed;}
-->
</style>
';
$posts = 1000000;
$showtopiclength = 0;
$topiclength = 40;
$forumexclude= "12,870,15,14,13,11,10,355,42,41,567,566,40,39,632,738,1920,1921,1922,866,119,120,121,122,1120,1121,710,84,127,734,709,501,1987,377,91,90,98,99,374,113,114,973,115,116,117,2707,2363,2364,2708,354,43,1137,80,81,82,1205,266,1206,268,269,1927,995,996,997,1207,1928,1825,353,349,351,352";
$forum=$_GET['forum'];
require "conf_global.php";
$mysql = mysql_connect( $INFO['sql_host'], $INFO['sql_user'], $INFO['sql_pass'] /*, $INFO['sql_driver'] */ );
if ( !$mysql ) {
die( "<b>mysql_connect()</b>: ". mysql_error() );
}
$select_db = mysql_select_db( $INFO['sql_database'], $mysql );
if ( !$select_db ) {
die( "<b>mysql_select_db()</b>: ". mysql_error() );
}
// Interroga il database con le variabili inserite sopra....QUI VA CAMBIATO IL VALORE DELL'ID forum.
if ($forum = $_GET['forum']) {
$getposts = mysql_query("SELECT posts, last_poster_name, last_poster_id, title, tid, $forum, last_post FROM ibf_topics WHERE (forum_id = ($forum) AND tid NOT IN ($forumexclude)) ORDER BY title ASC LIMIT $posts") OR DIE (mysql_error());
}
else{
DIE (mysql_error());
}
// Codice per mostrare risultati.
while ( $post = mysql_fetch_array($getposts)) {
$post[full_title] = $post[title];
if ($showtopiclength == 1 AND strlen($post[full_title]) > $topiclength) {
$post[short_title] = substr($post[full_title],0,$topiclength);
$post[short_title] = $post[short_title]."...";
}
else {
$post[short_title] = $post[full_title];
$lettera = $post[full_title][0];
}
echo
<<<EOD
<FONT SIZE=3><b><i>
<body link="black" alink="yellow" vlink="green">
<a name="r$lettera"><a href="$INFO[board_url]/index.php?showtopic=$post[tid]" target="_new">$post[short_title]</a></a>
<br>
$datefield
<i></b>
</body></FONT>
EOD;
}
?>
<--------------------------------------------->
i'm find in this forum a similar result ,and look this example code:
code 1:
Quote
//-----------------------------------------
// Build page links
//-----------------------------------------
$page_links = $this->ipsclass->build_pagelinks( array( 'TOTAL_POSS' => $max['max'],
'PER_PAGE' => $this->ipsclass->vars['showpolls_perpage'],
'CUR_ST_VAL' => $st,
'L_SINGLE' => "",
'BASE_URL' => $this->ipsclass->base_url."autocom=showpolls&order={$orderby}&ascdesc={$ordertype}",
) );
}
//-----------------------------------------
// Build the output
//-----------------------------------------
$output .= $this->ipsclass->compiled_templates['skin_showpolls']->polls_list( $polls, $page_links );
//-----------------------------------------
// Set the page title and navigation
//-----------------------------------------
$page_title = $this->ipsclass->vars['board_name']. " -> ".$this->ipsclass->lang['polls'];
$nav = array( $this->ipsclass->lang['polls'] );
// Build page links
//-----------------------------------------
$page_links = $this->ipsclass->build_pagelinks( array( 'TOTAL_POSS' => $max['max'],
'PER_PAGE' => $this->ipsclass->vars['showpolls_perpage'],
'CUR_ST_VAL' => $st,
'L_SINGLE' => "",
'BASE_URL' => $this->ipsclass->base_url."autocom=showpolls&order={$orderby}&ascdesc={$ordertype}",
) );
}
//-----------------------------------------
// Build the output
//-----------------------------------------
$output .= $this->ipsclass->compiled_templates['skin_showpolls']->polls_list( $polls, $page_links );
//-----------------------------------------
// Set the page title and navigation
//-----------------------------------------
$page_title = $this->ipsclass->vars['board_name']. " -> ".$this->ipsclass->lang['polls'];
$nav = array( $this->ipsclass->lang['polls'] );
or this similar code example:
code 2:
Quote
//-----------------------------------------
// Page jump
//-----------------------------------------
$pages = $this->ipsclass->adskin->build_pagelinks( array( 'TOTAL_POSS' => $max['total_logs'],
'PER_PAGE' => $perpage,
'CUR_ST_VAL' => $st,
'L_SINGLE' => "",
'L_MULTI' => $this->ipsclass->acp_lang['pages'].": ",
'BASE_URL' => $this->ipsclass->base_url."&".$this->ipsclass->form_code."&code=view_logs".$add.$_order.$_sort,
) );
//-----------------------------------------
// Build the table
//-----------------------------------------
$this->ipsclass->html .= $this->html->list_logins( $logins, $pages, $data, $add, $_st );
// Page jump
//-----------------------------------------
$pages = $this->ipsclass->adskin->build_pagelinks( array( 'TOTAL_POSS' => $max['total_logs'],
'PER_PAGE' => $perpage,
'CUR_ST_VAL' => $st,
'L_SINGLE' => "",
'L_MULTI' => $this->ipsclass->acp_lang['pages'].": ",
'BASE_URL' => $this->ipsclass->base_url."&".$this->ipsclass->form_code."&code=view_logs".$add.$_order.$_sort,
) );
//-----------------------------------------
// Build the table
//-----------------------------------------
$this->ipsclass->html .= $this->html->list_logins( $logins, $pages, $data, $add, $_st );
I can not understand how to use these codes to format a given number of results, you can help me???? thanks.
















