Syntax Help
Posted: Fri Feb 12, 2010 7:16 pm
Hello,
I have some code and I keep getting a syntax error "parse error, unexpected '(', expecting '}' in category.php on line 53"
You can view the entire code here:
Any assistance is greatly appreciated.
I have some code and I keep getting a syntax error "parse error, unexpected '(', expecting '}' in category.php on line 53"
You can view the entire code here:
Code: Select all
<?php get_header(); ?>
<?php get_sidebar(); ?>
<div class="middle">
<?php
if ( is_category() ) {
$cat = get_query_var('cat');
$child_cats = get_categories('child_of='.$cat);
if ($child_cats) {
//include the paginate class. I put it in the theme folder
include("paginate.php");
// This is the SQL Query to get the number of rows I have
$count = "SELECT COUNT(*) FROM $wpdb->terms AS t
INNER JOIN $wpdb->term_taxonomy AS tt
ON t.term_id = tt.term_id WHERE tt.taxonomy IN('category') AND tt.parent = '9'";
$number = mysql_query($count);
$row = mysql_fetch_array($number);
$num_rows = array_shift($row);
// Define some variable to hold our pagination settings
$page = !empty($_GET['current_page']) ? (int)$_GET['current_page'] : 1;
$perPage = 20; //Limit the result to 20, change this to your need
$paginate = new sitePagination($page,$perPage,$num_rows);
//the variables would be something like:
$parent = 9;// your category parent ID
$where = " tt.parent = '$parent'";
$in_taxonomies = 'taxonomy';
$orderby = 't.term_id';
$order = 'ASC';
//This is the actual SQL Query to fetch the Data from Database
$query = "SELECT * FROM $wpdb->terms AS t
INNER JOIN $wpdb->term_taxonomy AS tt
ON t.term_id = tt.term_id WHERE tt.taxonomy IN('category')
AND tt.parent = '$parent' LIMIT {$perPage} OFFSET {$paginate->offset()}";
$terms = $wpdb->get_results($query);
// A foreach loop to output the data nice and clean
foreach($terms as $term)
{
$cat_parent = get_category($term->parent);
//Had to use the $cat_parent to build the link
//if some has a better idea, would be nice
echo "<li><a href='".$cat_parent->slug.'/'.$term->slug."'>". $term->name ."</a></li>";
}
// The Fun starts here, all the code below will generate our dynamic page number
// The container css class is the same as WP PAGENAVI
// I'm using a custom pagination class I created
echo "<div class='wp-pagenavi'>";
echo "<span class='pages'>Page {$page} of {$paginate->totalPages()}</span>";
if($paginate->totalPages() > 1){
if($paginate->previousPageExists()){
if ( get_option('permalink_structure') ){
if($page)
echo '<a href="'.$paginate->previousPage().'">« Previous</a>';
else
echo '<a href="'.$cat_parent->slug.'/page/'.$paginate->previousPage().'">« Previous</a>';
}else{
echo '<a href="?cat='.$cat_parent->term_id.'¤t_page='.$paginate->previousPage().'">« Previous</a>';
}
}
}
for($i=1;$i < ceil($paginate->totalPages()) + 1;$i++){
if($page == $i)
echo '<span class="current">'.$i.'</span>';
else
if ( get_option('permalink_structure') ){
if($page)
echo '<a href="'.$i.'">'.$i.'</a>';
else
echo '<a href="'.$cat_parent->slug.'/page/'.$i.'">'.$i.'</a>';
}else{
echo '<a href="'.$cat_parent->slug.'/?current_page='.$i.'">'.$i.'</a>';
}
}
if($paginate->totalPages() > 1){
if($paginate->nextPageExists()){
if ( get_option('permalink_structure') ){
if($page)
echo '<a href="'.$paginate->nextPage().'">Next »</a>';
else
echo '<a href="'.$cat_parent->slug.'/page/'.$paginate->nextPage().'">Next »</a>';
}else{
echo '<a href="?cat='.$cat_parent->term_id.'¤t_page='.$paginate->nextPage().'">Next »</a>';
}
}
}
echo "</div>";
);
} else { ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<p><small><?php the_time('F jS, Y') ?> <?php the_author() ?></small> Posted in <?php the_category(', ') ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', '', ' | '); ?> <?php if(function_exists('the_views')) { the_views(); } ?></p>
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
<br />
<!-- AddThis Bookmark Post Button BEGIN -->
<?php echo "<div class=\"addthis\"><a href=\"http://www.addthis.com/bookmark.php?pub=blogohblog&url=".get_permalink()."&title=".get_the_title($id)."\" title=\"Bookmark using any bookmark manager!\" target=\"_blank\"><img src=\"http://s9.addthis.com/button1-bm.gif\" width=\"125\" height=\"16\" border=\"0\" alt=\"AddThis Social Bookmark Button\" /></a></div>"; ?>
<!-- AddThis Bookmark Post Button END -->
</div>
<div class="br"><br /></div>
<?php endwhile; ?>
<div>
<div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
</div>
<br />
<?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php endif; ?>
<?php
}
}
?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>