Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Smarty Paginate Invalid Tags

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
Simply Seth
Smarty Rookie


Joined: 27 Jan 2005
Posts: 8

PostPosted: Thu Jan 27, 2005 8:08 am    Post subject: Smarty Paginate Invalid Tags Reply with quote

I've spent days trying to figure this pagination stuff out.
I've read the example many times and I've come close to getting it to work.

I get this error when attempting to run my php script :

Quote:
Fatal error: Smarty error: [in /var/www/templates/index.tpl line 55]: syntax error: unrecognized tag 'paginate_prev' (Smarty_Compiler.class.php, line 565) in /usr/share/Smarty/libs/Smarty.class.php on line 1088



it seems to have an issue with these three tags in my index.tpl file :
Code:
 {paginate_prev} {paginate_middle} {paginate_next}


The above three tags I put as is in the index.tpl file .. I don't know if I'm supposed to wrap them in some other tag or something


IT works fine without the three tags (except for pagination of course)

here is my index.php file:

Code:
<?php
session_start();
header("Cache-control: private"); //IE 6 Fix

require ('Smarty.class.php');
require('/usr/share/Smarty/libs/SmartyPaginate.class.php');

$smarty =& new Smarty;


// required connect
SmartyPaginate::connect();

// set items per page
SmartyPaginate::setLimit(7);



$smarty->plugin_dir = '/var/www/plugins/';
$smarty->template_dir = '/var/wwww/templates/';
$smarty->compile_dir = '/var/www/templates_c/';
$smarty->config_dir = '/var/www/configs/';
$smarty->cache_dir = '/var/www/cache/';



require 'inc/whitepages.inc';



$smarty->assign('results',$action);
$smarty->assign('rnb',rawurlencode('r&b'));
SmartyPaginate::assign($smarty);
$smarty->display('/var/www/templates/index.tpl');



?>


here is my whitepages.inc file :
Code:


<?php

/*
ini_set('display_errors','off');
ini_set('log_errors','1');
ini_set('error_log','./errors.txt');
ini_set('error_reporting','5');
ini_set('ignore_repeated_errors','1');
*/

if (empty($_POST['keyword']))
{
    if (empty($_GET['type']))
    {
    $type = "artists";
    $_SESSION['type'] = "artists";
    $smarty->assign('sess_type',$_SESSION['type']);
    }
    else
    {
    $type =  addslashes(strtolower(trim($_GET['type'])));
    $_SESSION['type'] =  addslashes(strtolower(trim($_GET['type'])));
    $smarty->assign('sess_type',$_SESSION['type']);
    }
   

    if (empty($_GET['genre']))
    {
    $genre = 0;
    }
    else
    {
    $genre =  addslashes(strtolower(trim($_GET['genre'])));
    }

        $list_artists = new whitepages;
        $action = $list_artists -> list_of_artists($genre,$type);
        $smarty->assign('list_array',$action);
}
else
{

$keyword = addslashes(strtolower(trim($_POST['keyword'])));
        $search_artists = new whitepages;
        $action = $search_artists->search_artists($keyword);
        $smarty->assign('list_array',$action);
}

//WhitePages Class

class whitepages
{
    //Search Function
   
    //This is the List function
    function list_of_artists($genre,$type)   
    {
   
        //If $genre is empty ...
        if (empty($genre))
        {
            // ... And if $type is artists ...
            if ($type == "artists")
            {
//... We use this SQL command
//Which searches for ARTISTS
$list_sql =<<< SQL
    select artists_name, artists_label,artists_url,artists_genre,artists_type
    from artists where (artists_type='artist' or artists_type='both')
    AND artists_active='y'
    order by artists_name ASC
SQL;
$list_sql .=  ' LIMIT '.SmartyPaginate::getCurrentIndex().','.SmartyPaginate::getLimit();
            }
           
            //OR if $genre is empty and $type is producers ...
            elseif ($type == "producers")
            {
// ... We use this SQL command
//Which searches for PRODUCERS
$list_sql =<<< SQL
    select artists_name, artists_label,artists_url,artists_genre,artists_type
    from artists where (artists_type='producer' or artists_type='both')
    AND artists_active='y'
    order by artists_name ASC
SQL;   
$list_sql .=  ' LIMIT '.SmartyPaginate::getCurrentIndex().','.SmartyPaginate::getLimit();
        }//end of type check

        } //end of genre check 1

        //If the genre is rap or r&b
        elseif($genre == "rap" || $genre == "r&b")
        {   
            //if $type is artists
            if ($type == "artists")
            {   
//We use this SQL command
//Which searches for ARTISTS  according to chosen GENRE
$list_sql =<<< SQL
    select artists_name, artists_label,artists_url,artists_genre,artists_type
    from artists where artists_genre LIKE '%$genre%'
    AND (artists_type='artist' or artists_type='both')
    AND artists_active='y'
    order by artists_name ASC

SQL;         
$list_sql .=  ' LIMIT '.SmartyPaginate::getCurrentIndex().','.SmartyPaginate::getLimit();
  } //end of type check

            //If genre is rap or r&b and type is producers
            elseif ($type == "producers")
            {
//We use this SQL command
//Which searches for PRODUCERS according to chosen GENRE
$list_sql =<<< SQL
    select artists_name, artists_label,artists_url,artists_genre,artists_type
    from artists where artists_genre LIKE '%$genre%'
    AND (artists_type='producer' or artists_type='both')
    AND artists_active='y'
    order by artists_name ASC

SQL;           
$list_sql .=  ' LIMIT '.SmartyPaginate::getCurrentIndex().','.SmartyPaginate::getLimit();
                       }//end of type check
        }//end of genre check 2

           
        //If genre is not Rap or R&B
        elseif ($genre == "other")
        {
            //If $type is artists
            if ($type == "artists")
            {   
//We use this SQL command
//Which searches for ARTISTS according to
//House,Spoken Word and Techno GENRES
$list_sql =<<< SQL
    select artists_name, artists_label,artists_url,artists_genre,artists_type
    from artists where
    (artists_genre  LIKE '%house%' OR artists_genre  LIKE '%spoken word%'
    OR artists_genre LIKE '%techno%')
    AND (artists_type='artist' OR artists_type='both')
    AND artists_active='y'
    order by artists_name ASC
LIMIT SmartyPaginate::getCurrentIndex(),SmartyPaginate::getLimit()
SQL;           
$list_sql .=  ' LIMIT '.SmartyPaginate::getCurrentIndex().','.SmartyPaginate::getLimit();
                        } //end of type check
           
            //IF genre is not Rap or R&B and type is producers
            elseif ($type == "producers")
            {   
//We use this SQL command
//Which searches for PRODUCERS  according to
//House,Spoken Word and Techno GENRES
$list_sql =<<< SQL
    select artists_name, artists_label,artists_url,artists_genre,artists_type
    from artists where
    (artists_genre  LIKE '%house%' OR artists_genre  LIKE '%spoken word%'
    OR artists_genre LIKE '%techno%')
    AND (artists_type='producer' OR artists_type='both')
    AND artists_active='y'
    order by artists_name ASC

SQL;           
$list_sql .=  ' LIMIT '.SmartyPaginate::getCurrentIndex().','.SmartyPaginate::getLimit();
                       } //end of type check

        } //end of genre check 3
       
    $list_link = mysql_connect("localhost", "nunya", "beezwax");
        if (!isset($list_link))
        {
                fwrite($err_file,mysql_error());
                fwrite($err_file,"\n");
                }
        else
        {    //we select the DataBase
            $list_select = mysql_select_db("artists");
            if (!$list_select)
            {
                    fwrite($err_file,mysql_error());
                    fwrite($err_file,"\n");
                    }
            else
            {
            //we run the actual query
            $list_query = mysql_query($list_sql,$list_link);
            echo $list_sql;

            //we count the results for pagination
            $_SESSION['count'] = mysql_num_rows($list_query);
             SmartyPaginate::setTotal(count($list_query));
           
                while ($list_data = mysql_fetch_assoc($list_query))
                {
                $list_artists_array[] = $list_data;
                }
                return $list_artists_array;
            }
        }
    mysql_close($list_link);
   
    } //end of list function
           
} //end of whitepages class
?>
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7366
Location: Lincoln Nebraska, USA

PostPosted: Thu Jan 27, 2005 2:34 pm    Post subject: Reply with quote

You have to put the three pagination functions in your plugin directory.
Back to top
View user's profile Send private message Visit poster's website
Simply Seth
Smarty Rookie


Joined: 27 Jan 2005
Posts: 8

PostPosted: Thu Jan 27, 2005 3:24 pm    Post subject: Reply with quote

They are in fact there :
Quote:
ls /var/www/plugins
function.paginate_middle.php function.paginate_prev.php
function.paginate_next.php function.pagination.php
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Thu Jan 27, 2005 3:55 pm    Post subject: Reply with quote

safe_mode enabled?
can you use other plugins from /var/www/plugins?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Jan 27, 2005 5:23 pm    Post subject: Reply with quote

Subtle error -- in the line:

$smarty->plugin_dir = '/var/www/plugins/';

it ought be plugins_dir.
Back to top
View user's profile Send private message
Simply Seth
Smarty Rookie


Joined: 27 Jan 2005
Posts: 8

PostPosted: Thu Jan 27, 2005 5:54 pm    Post subject: Reply with quote

kewl ... all works except if I put
Code:
 {paginate_middle format="page"}


but if I leave off the quotes it works ... go figger

Thanks for all the help so far
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP