Page 1 of 1

iui and php - please help

Posted: Fri Jul 23, 2010 11:03 am
by jarv
hi, I am using the DIGG DEMO from Joe Hewitt's iui: http://joehewitt.com/iui/samples/digg/#___1__

in my site, I have a list of pubs: http://www.jbiddulph.com/iphone/pubs/default.php

you must login

user: test
pass: test

when you get to the pubs.php page when logged in, if you view source you can see the list of pubs but they are not displaying like in the DIGG DEMO, please help:

Code: Select all

<?php
include_once("config.php");
include_once("functions.php");
// Check user logged in already:
checkLoggedIn("yes");
//doCSS(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>gopub</title>
<link rel="stylesheet" type="text/css" href="stylesheets/style1.css" title="default" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; minimum-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
		<link rel="apple-touch-icon" href="../iui/iui/iui-logo-touch-icon.png" />
		<style type="text/css" media="screen">@import "../iui/iui/iui.css";</style>
 		<script type="application/x-javascript" src="../iui/iui/iui.js"></script>
		<meta name="apple-touch-fullscreen" content="YES" />
<script type="text/javascript" src="js/jva.js"></script>
<style type="text/css">

body > ul > li {
    font-size: 14px;
}

body > ul > li > a {
    padding-left: 54px;
    padding-right: 40px;
    min-height: 34px;
}

li .digg-count {
    display: block;
    position: absolute;
    margin: 0;
    left: 6px;
    top: 7px;
    text-align: center;
    font-size: 110%;
    letter-spacing: -0.07em;
    color: #93883F;
    font-weight: bold;
    text-decoration: none;
    width: 36px;
    height: 30px;
    padding: 7px 0 0 0;
    background: url(shade-compact.gif) no-repeat;
}

h2 {
    margin: 10px;
    color: slateblue;
}

p {
    margin: 10px;
}
</style>
</head>

<body>
	
<?
// how many rows to show per page
$rowsPerPage = 20;

// by default we show first page
$pageNum = 1;

// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
	$pageNum = $_GET['page'];
}

$offset = ($pageNum - 1) * $rowsPerPage;
$query  = "SELECT * FROM pubs LIMIT $offset, $rowsPerPage";
$result = mysql_query($query) or die(mysql_error().'<br>SQL: ' . $query);  

//looping counties
$query1  = "SELECT rsCounty, COUNT(PubID) AS County_Count FROM pubs GROUP BY rsCounty";
$result1 = mysql_query($query1) or die(mysql_error().'<br>SQL: ' . $query1);  

$county_select_options = '<option value="">Search county</option>';
while ($row = mysql_fetch_assoc($result1))
{
    $counties[$row['rsCounty']] = $row['County_Count'];
    // $county_select_options .= '<option value="display.php?PubID='.$row['id'].'">'.$row['rsCounty'].' (x'.$row['County_Count'].')</option>'."\n";
}
        // make this arrays not strings:
    $values = array();
    $labels = array();
        // compute the sum:
        $total = array_sum($counties);
    foreach($counties as $rsCounty=>$count){
                // compute percent and add to values list:
        $values[] = ($count*100/$total);
        $labels[] = $rsCounty;
    }
        // convert array $values to a string comma separated
    $values = implode(',',$values);
        // same conversion for $labels but '|' separated
    $labels = implode('|', $labels);
    $url = 'http://chart.apis.google.com/chart?cht=p3&chd=t:'.$values.'&chs=480x200&chl='.$labels.'&chco=b0d584';
    ?>
	 <img src="<?php echo $url ?>" />
	 <?
// start main page
while($row = mysql_fetch_array($result)){
echo '<div id="pubholder" class="wrap">';
$PUBID = $row['PUBID'];
$RSPUBNAME = $row['RSPUBNAME'];
$RSADDRESS = $row['RSADDRESS']; 
$RSPOSTCODE = $row['RSPOSTCODE'];
$RSTEL = $row['RSTEL'];
$RSTOWN = $row['RSTOWN'];
$RSCOUNTY = $row['RSCOUNTY'];
?>
	<div class="toolbar">
        <h1 id="pageTitle"></h1>
        <a id="backButton" class="button" href="#"></a>
        <a class="button" href="#searchForm">Search</a>
    </div>
    <div class="rightbar">
	  <h1><? print($_SESSION["RSUSER"]); ?></h1>
	  <h3><a href="logout.php">logout</a></h3>
	</div>
	 <ul title="digg" selected="true">
<?
//div container of header and information
echo <<<EOF
  <li><a title="$PUBID" id="$PUBID" name="$PUBID"></a>
  <div class="entry_header">
    <div class="pubname">$RSPUBNAME</div></li>
EOF;
if	($_SESSION["RSUSER"] == "admin") 
{
echo "<a href=\"edit.php?PUBID=$PUBID\" class=\"small\">edit this pub</a>";
}
echo  "</br>";
echo  "</br>";
echo	"<div class=\"county\">".$RSCOUNTY."</div><div class=\"town\">".$RSTOWN."</div>";
echo "</div>";
echo "</div>";
}
echo "</ul>";
?>

<?
// how many rows we have in database
$query   = "SELECT COUNT(*) AS numrows FROM pubs";
$result  = mysql_query($query) or die('Error, query failed');
$row     = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row['numrows'];

// how many pages we have when using paging?
$maxPage = ceil($numrows/$rowsPerPage);



// print the link to access each page
$self = $_SERVER['PHP_SELF'];
$nav  = '';

for($page = 1; $page <= $maxPage; $page++)
{
   if ($page == $pageNum)
   {
      $nav .= " $page "; // no need to create a link to current page
   }
   else
   {
      $nav .= " <a href=\"$self?page=$page\">$page</a> ";
   }
}

// creating 'previous' and 'next' link
// plus 'first page' and 'last page' link

// creating previous and next link
// plus the link to go straight to
// the first and last page

if ($pageNum > 1)
{
	$page = $pageNum - 1;
	$prev = " <a href=\"$self?page=$page\">[Prev]</a> ";
	
	$first = " <a href=\"$self?page=1\">[First Page]</a> ";
} 
else
{
	$prev  = '&nbsp;'; // we're on page one, don't print previous link
	$first = '&nbsp;'; // nor the first page link
}

if ($pageNum < $maxPage)
{
	$page = $pageNum + 1;
	$next = " <a href=\"$self?page=$page\">[Next]</a> ";
	
	$last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> ";
} 
else
{
	$next = '&nbsp;'; // we're on the last page, don't print next link
	$last = '&nbsp;'; // nor the last page link
}


// print the page navigation link
echo "<div class=\"centertext\">";
echo $first . $prev .  $nav ." Showing page <strong>$pageNum</strong> of <strong>$maxPage</strong> pages " . $next . $last;
echo "</div>";

?>
</body>
</html>