Login   Register  
PHP Classes
elePHPant
Icontem

File: index2.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Valics Lehel  >  PaginationClass  >  index2.php  >  Download  
File: index2.php
Role: Example script
Content type: text/plain
Description: Example with just 2 templates, "main" in and "content" our case
Class: PaginationClass
Show links to browse listings using templates
Author: By
Last change:
Date: 2008-03-23 01:27
Size: 1,778 bytes
 

Contents

Class file image Download
<?php
/**
* index2.php
* This is an example with just 2 templates, "main" in and "content" our case.
*
* @package cls_pagination
* @author Elteto Zoltan
* @copyright Copyright GrafxSoftware (c) 2006
* @version $Id: index2.php,v 1.4 2006/02/10 19:30:40 zelteto Exp $
*/

include_once("./language/en.inc.php");
include_once(
"./includes/cls_fast_template.php");
include_once(
"./includes/cls_pagination.php");

// VARIABLES:
// item would be the index in the pagination but even in the
// database filterring.
$item = (int)$_GET["item"];
// number_items is the LIMIT variable - ex: LIMIT $item,$number_items
$number_items 15;
// $number_pages is the number of page numbers shown at one iteration
$number_pages 6;

/**
* THIS PART IS FOR DB QUERING AND DATA DYSPLAY!!
*/
// this is a DB variable and has value based on the query we do in DB
$total_items 100;
// Define the template
$page = new FastTemplate("./programtemplates");
$page->define(array("main"=>"index_main_templ.html","content"=>"index_content_templ.html"));

// Pagination and their settings.
$pagi = new Pagination();

$pagi->setNumberItems($number_items);
$pagi->setNumberPages($number_pages);
$pagi->setType(5);
// We have 2 temnplates and "content" is the one whicj the pagination tags.
$pagi->setTemplate("content");
// This is the url we want to use in the iteration
// Please be aweare of the other get variables that need to be kept.
$pagi->setUrl("index2.php?item=");

// Lets rock :)
$pagi->make($total_items$item, &$page);


// FastTemplate stuff
$page->multiple_assign("s_");
$page->multiple_assign("conf_");
$page->multiple_assign_define("LANG_");
$page->parse("BODY", array("content","main"));
$page->FastPrint();

$page->clear_all();

?>