Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Using SmartyPaginate Plugin
Well list, I found SmartyPaginate Plugin on Smarty Plugins Repository and I 
need to use him beacuse I have a Guestbook in my site and the results must b
e show start in 1 and end in 5. I see the example that came with him but I n
ot understand some things. Take a look to example:

File: index.php

////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////

session_start();
require('Smarty.class.php');
require('SmartyPaginate.class.php');
$smarty =& new Smarty;
// required connect
SmartyPaginate::connect();
// set items per page
SmartyPaginate::setLimit(25);
// assign your db results to the template
$smarty->assign('results', get_db_results());
// assign {$paginate} var
SmartyPaginate::assign($smarty);
// display results
$smarty->display('index.tpl');
 
function get_db_results() {
// normally you would have an SQL query here,
// for this example we fabricate a 100 item array
// (emulating a table with 100 records)
// and slice out our pagination range
// (emulating a LIMIT X,Y MySQL clause)
$_data = range(1,100);
 SmartyPaginate::setTotal(count($_data));

return array_slice($_data,  SmartyPaginate::getCurrentIndex(),Smarty
Paginate:
:getLimit());
}

////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////

In first: Why Smarty is instance $smarty object by reference and not normall
y? I see this in considerably examples. The second is: If a try to paginate 
results from a query, where is the query? I not see them into the example co
de? Where they should stay?

Regards

 

Reynier Pérez Mira

3ero. Ing. Informática

Entre más inteligente me siento, más me doy cuenta de lo ignorante que soy. 

 



Report this thread to moderator Post Follow-up to this message
Old Post
Reynier Perez Mira
04-11-05 09:02 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Smarty Templates archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:06 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.