Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Luiz F B Escobar  >  navbar  >  example.php  >  Download  
File: example.php
Role: ???
Content type: text/plain
Description: Exemplo para NAVBAR.PHP
Class: navbar
Author: By
Last change:
Date: 2001-10-10 10:36
Size: 1,827 bytes
 

Contents

Class file image Download
<?php
// *********************************************************************************************
// crie um DATABASE LINKS
// e uma tabela LINKS com um campo chamado URL
// fonte SQL abaixo...
/* file: links.sql
#
# DataBase/Table structure for table `links`
#

CREATE DATABASE links;

CREATE TABLE links (
  url varchar(50) NOT NULL default '',
  desc tinyint(50) NOT NULL default '0',
  PRIMARY KEY  (url)
) TYPE=MyISAM;

#
# Dumping data for table `links`
#

INSERT INTO links VALUES ('link 1','');
INSERT INTO links VALUES ('link 2','');
INSERT INTO links VALUES ('link 3','');
INSERT INTO links VALUES ('link 4','');
INSERT INTO links VALUES ('link 5','');
INSERT INTO links VALUES ('link 6','');
INSERT INTO links VALUES ('link 7','');
INSERT INTO links VALUES ('link8','');
INSERT INTO links VALUES ('link 9','');
INSERT INTO links VALUES ('link 10','');
*/

// database connection stuff
$db = mysql_connect("127.0.0.1", "escobar", "");

mysql_select_db("link", $db) or die(mysql_errno() . ": " . mysql_error() . "<br>");

// including the navbar class
include("./navbar.php");

$nav = new navbar;
$nav->numrowsperpage = 3;
$sql = "SELECT * FROM link ";
$result = $nav->execute($sql, $db, "optimized", "mysql");
$rows = mysql_num_rows($result);

// v1.6 coloca o navegador embaixo 
$nav->Pages("header", 'all', 'off');

for ($y = 0; $y < $rows; $y++) {
  $data = mysql_fetch_object($result);
  echo $data->url . "<br>\n";
}

/* // modo antigo  com problemas
$limit_links = $nav->showPart($full_links, $row, 20);
echo "This is the limited list of paginated links<br>\n";
for ($y = 0; $y < count($limited_links); $y++) {
  echo $limited_links[$y] . "&nbsp;&nbsp;";
}
*/

// v1.6 coloca o navegador embaixo 
$nav->Pages("footer", 'sides', 'off');
?>