Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/07/2005, 01:44
Avatar de alrik
alrik
 
Fecha de Ingreso: enero-2005
Mensajes: 45
Antigüedad: 19 años, 3 meses
Puntos: 0
Busqueda Hacer un <!--pagebreak--> sin phpnuke

Esa es mi pregunta.
Hay una funcion en phpnuke que se llama page break y que te rompe las paginas y te las coloca por links es decir pagina 1 2 3... etc, pero no es la tipica paginacion de registros, si no que es una paginación de un solo registro.

Otra cosa, si me dais un script ponedme para que sirven las variables, que si no es un lio.

Buscando por ahi, conseguí este codigo, pero no veo nada que me pueda servir, a ver si me le podeis tunear un poco.

Código PHP:
<?
// Set Script Variables
$DB_Host="localhost";
$DB_Name="test";
$DB_User="root";
$DB_Pass="";
$Per_Page=10;
// Open MySQL Connection
$Connection=mysql_connect($DB_Host$DB_User$DB_Pass);
// Run The Query Without a Limit to get Total result
$SQL="SELECT COUNT(*) AS Total FROM Products WHERE Description LIKE '%".$_REQUEST['Keyword']."%'";
$SQL_Result=mysql_db_query($DB_Name$SQL);
$SQL_Result_Array=mysql_fetch_array($SQL_Result);
$Total=$SQL_Result_Array['Total'];
// Create a new SELECT Query with the ORDER BY clause and without the COUNT(*)
$SQL="SELECT * FROM Products WHERE Description LIKE '%".$_REQUEST['Keyword']."%' ORDER BY ProductID";
// Append a LIMIT clause to the SQL statement
if (empty($_GET['Result_Set']))
{
$Result_Set=0;
$SQL.=" LIMIT $Result_Set, $Per_Page";
}else
{
$Result_Set=$_GET['Result_Set'];
$SQL.=" LIMIT $Result_Set, $Per_Page";
}
// Run The Query With a Limit to get result
$SQL_Result=mysql_db_query($DB_Name$SQL);
$SQL_Rows=mysql_num_rows($SQL_Result);
// Display Results using a for loop
for ($a=0$a $SQL_Rows$a++)
{
$SQL_Array=mysql_fetch_array($SQL_Result);
$Product=$SQL_Array['Name'];
$Description=$SQL_Array['Description'];
echo 
"$Product - $Description<BR><BR>";
}
// Create Next / Prev Links and $Result_Set Value
if ($Total>0)
{
if (
$Result_Set<$Total && $Result_Set>0)
{
$Res1=$Result_Set-$Per_Page;
echo 
"<A HREF=\"test.php?Result_Set=$Res1&Keyword=".$_REQUEST['Keyword']."\"><;<; Previous Page</A> ";
}
// Calculate and Display Page # Links
$Pages=$Total $Per_Page;
if (
$Pages>1)
{
for (
$b=0,$c=1$b $Pages$b++,$c++)
{
$Res1=$Per_Page $b;
echo 
"<A HREF=\"test.php?Result_Set=$Res1&Keyword=".$_REQUEST['Keyword']."\">$c</A> \n";
}
}
if (
$Result_Set>=&& $Result_Set<$Total)
{
$Res1=$Result_Set+$Per_Page;
if (
$Res1<$Total)
{
echo 
" <A HREF=\"test.php?Result_Set=$Res1&Keyword=".$_REQUEST['Keyword']."\">Next Page >></A>";
}
}
}
// Close Database Connection
mysql_close($Connection);
?>
Gracias