Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 09:59 pm EDT

Geeklog Forums

Tag hack - pagination


Hiro

Anonymous
Hello, there is a custom tag script that i need to paginate, can anyone help me?
Database is modified, added "tag" in stories

Text Formatted Code
<?php

require_once ('lib-common.php');
require_once ($_CONF['path_system'] . 'lib-story.php');


$display .= COM_siteHeader();
if (isset ($_GET['msg'])) {
    $plugin = '';
    if (isset ($_GET['plugin'])) {
        $plugin = COM_applyFilter ($_GET['plugin']);
    }
    $display .= COM_showMessage (COM_applyFilter ($_GET['msg'], true), $plugin);
}


// Show any Plugin formatted blocks
// Requires a plugin to have a function called plugin_centerblock_<plugin_name>
$displayBlock = PLG_showCenterblock (1, $page, $topic); // top blocks
if (!empty ($displayBlock)) {
    $display .= $displayBlock;
    // Check if theme has added the template which allows the centerblock
    // to span the top over the rightblocks
    if (file_exists($_CONF['path_layout'] . 'topcenterblock-span.thtml')) {
            $topspan = new Template($_CONF['path_layout']);
            $topspan->set_file (array ('topspan'=>'topcenterblock-span.thtml'));
            $topspan->parse ('output', 'topspan');
            $display .= $topspan->finish ($topspan->get_var('output'));
            $GLOBALS['centerspan'] = true;
    }
}

if (isset ($_USER['uid']) && ($_USER['uid'] > 1)) {
    $result = DB_query("SELECT maxstories,tids,aids FROM {$_TABLES['userindex']} WHERE uid = '{$_USER['uid']}'");
    $U = DB_fetchArray($result);
} else {
    $U['maxstories'] = 0;
}

$maxstories = 0;
if ($U['maxstories'] >= $_CONF['minnews']) {
    $maxstories = $U['maxstories'];
}
if ((!empty ($topic)) && ($maxstories == 0)) {
    $topiclimit = DB_getItem ($_TABLES['topics'], 'limitnews',
                              "tid = '{$topic}'");
    if ($topiclimit >= $_CONF['minnews']) {
        $maxstories = $topiclimit;
    }
}
if ($maxstories == 0) {
    $maxstories = $_CONF['limitnews'];
}

$limit = $maxstories;


$tag = mysql_real_escape_string($_GET['tag']);
$display .= "<h1>Tag: $tag</h1>";

$sql = DB_query("SELECT * FROM ".$_TABLES['stories']." as t WHERE tag LIKE '%".$tag."%' order by date DESC ");
$num_pages = ceil ($D['*'] / 7);

    // get remaining stories
    while ($A = DB_fetchArray ($sql)) {
        $display .= STORY_renderArticle ($A, 'y');
    }


$display .= COM_siteFooter (true); // The true value enables right hand blocks.

// Output page
echo $display;

?>


This shows all the tags...i need to paginate, thanks!
 Quote

All times are EDT. The time is now 09:59 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content