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

Smarty-Paginate Help Please

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


Joined: 11 Oct 2012
Posts: 6

PostPosted: Thu Oct 11, 2012 7:37 pm    Post subject: Smarty-Paginate Help Please Reply with quote

I'm new to smarty and smarty-paginate and have run into a block of what I am doing wrong.

in my php file I have the following code

$smarty->assign('results',get_db_results());
SmartyPaginate::assign($smarty);

function get_db_results()
{

$tsql = "SELECT UserName,Role,Accounts_Access,Group_Access,Full_Name,CONVERT(char,first_login,100), ".
" CONVERT(char,last_login,100),IPAddress,TimeZone,Language,Password,Single_Multi_Account ".
"FROM CustomerPortal.dbo.Login ".
"WHERE Entity = '".$_SESSION["MyEntity"]."' ".
"ORDER BY UserName ";

// RUN THE QUERY
global $conn;

$tquery = sqlsrv_query($conn,$tsql);


// SCROLL THROUGH THE ZONES
WHILE ($row = sqlsrv_fetch_array($tquery ) )
{
$key3[] = $row;
} // WHILE

SmartyPaginate::setTotal(count($key3));
SmartyPaginate::setUrlVar('page_next');

return array_slice($key3, SmartyPaginate::getCurrentIndex(),SmartyPaginate::GetLimit());

}


In my tpl I have

{foreach from=$results item=foo key=thisacct name=users}
{assign var="passvar" value="`$foo[0]`"}
<tr>
<td align="left" nowrap >
<font color=#000000><input type="checkbox" name="fdelbox" onClick="ajaxFunction({$rowpos});"></font>
<input type="hidden" name="husernm{$rowpos}" value="{$passvar}" >
</td>
<td align="left" nowrap class="tdinput">
<a href="User_Profile.php?id={$thisacct}">{$foo[0]}</a>
</td>
<td align="left" nowrap class="tdinput">{$foo[4]}</td>
<td align="left" nowrap class="tdinput">{$foo[1]}</td>
<td align="left" nowrap class="tdinput">{$foo[3]}</td>
<td align="left" nowrap class="tdinput">{$foo[2]|truncate:25}</td>
</tr>
{assign var="rowpos" value="`$rowpos+1`"}
{/foreach}
</table>

If I display {$paginate.first} or {$paginate.last} or {$paginate.total} I get the correct values.

If I put {paginate_first} or {paginate_next}..... I get an error.

I'm not sure how I tell the program to do a next and previous. Am I missing code somewhere?

Any assistance would be greatly appreciated!
Thanks!
Back to top
View user's profile Send private message
joannem
Smarty Rookie


Joined: 11 Oct 2012
Posts: 6

PostPosted: Thu Oct 11, 2012 8:17 pm    Post subject: Found the Issue in another thread Reply with quote

I was missing the paginate plugins in smary plugin directory.
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