In TCPDF, how to get current page number as integer? - php

I tried using $pdf-getAliasNumPage() and it shows the page number if it is rendered in PDF.
But when I experimented on a basic PHP and printed it, it returns only "{:pnp:}".
I used to have an if condition if the page is already changed so that I can reset a value = 0 again, but the condition was always false due to the returned value of getAliasNumPage() is equal to "{:pnp:}".
Is there any way I can find the page number as an integer? What TCPDF function is that?
I only declared AddPage() once because I don't need it.
Already used $pdf->getPage(); only returns 0.
Thanks!
$this->payroll_id = $request->getParameter('payroll_id');
$this->class = new PsPayroll();
$config = sfTCPDFPluginConfigHandler::loadConfig();
$pdf = new reportPDF(LANDSCAPE, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$month = $this->class->mlFetchPayroll();
$month->execute(array($this->payroll_id));
$catch = "";
while ($print_month = $month->fetch()){
$catch = $print_month[8];
}
$pdf->SetCreator(Aaron);
$pdf->setMonth($catch);
$pdf->SetAuthor('');
$pdf->SetTitle('Payroll Report');
$pdf->SetSubject('');
$pdf->SetKeywords('');
$pdf->SetHeaderData('logo.png', '25', '', $catch);
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 4, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER + 15);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->setFontSubsetting(true);
$pdf->SetFont('freesans', '', 9.5, '', true);
$html .= '<table class = "table hover">
<thead>
<tr>
<th>Employee Information</th>
<th>Monthly Salary</th>
<th>Earnings</th>
<th>Deductions</th>
<th>Net Pay Signature</th>
</tr>
</thead>
<tbody>';
$pager = 1;
$prepare = $this->class->mlFetchPayroll();
$prepare->execute(array($this->payroll_id));
while ($myrow = $prepare->fetch()){
$total_net_pay = 0;
$total_earning = 0;
$total_deduction = 0;
$html .= '<br><tr nobr="true"><td>' . $myrow[2] . '<br>'. $myrow[3] . '<br>' . $myrow[4] . '</td><td>' . number_format($myrow[5], 2) . '</td><td>';
$earning_array = $this->class->mlFetchEarningPayslip($myrow[10]);
foreach ($earning_array as $k => $valk){
$net_pay += $valk;
$total_earning += $valk;
$html .= '<table><tr><td>' . $k . '</td><td>' . number_format($valk, 2) . '</td></tr></table>';
}
$html .= "</td><td>";
$deduction_array = $this->class->mlFetchDeductionPayslip($myrow[10]);
foreach ($deduction_array as $i => $val){
$net_pay -= $val;
$total_deduction += $val;
$html .= '<table><tr><td>' . $i . '</td><td>'. number_format($val, 2) . '</td></tr></table>';
}
$html .= '</td><td>';
$array_date = $this->class->mlDivideMonth($myrow[8]);
$k = 0;
foreach ($array_date as $value){
$breakdown = 0.00;
$k++;
$monthly_salary = $myrow[5];
$monthly_salary += $total_earning - $this->class->mlFetchPERA($myrow[10]);
$monthly_salary -= $total_deduction;
$break_down = $monthly_salary/ 4;
$html .= '<table><tr><td align="right">';
if ($breakdown < 0)
$html .= 0;
else if ($k == 2){
$a = round($break_down, 2);
$b = $a + $this->class->mlFetchPERA($myrow[10]);
$c = number_format($b, 2);
$html .= $c;
}
else{
$a = round($break_down, 2);
$b = number_format($a, 2);
$html .= $b;
}
$html .= ' </td><td>............... </td><td>' . $value . '</td></tr></table>';
}
$html .= '</td></tr>';
$pager = $pdf->getAliasNumPage();
if ($pager == 1){
$html .= 'This is first page ' . $pdf->getAliasNumPage();
}
else{
$pager = $pdf->getAliasNumPage();
$html .= "This is page " . $pdf->getAliasNumPage();
}
// $html .= 'sample '. $pager;
}
$html .= '</tbody></table>';
$pdf->AddPage();
$pdf->writeHTML($html, true, false, false, true, 'Aaron');
$pdf->Output('payroll_'.$catch.'.pdf', 'I');
throw new sfStopException();

both PageNo() and getPage() will return the current page number.
$this->PageNo();
$this->getPage();

The correct function is PageNo()
http://www.tcpdf.org/doc/code/classTCPDF.html#a9ad828b184f08828f570a7e52316ba79
TCPDF::PageNo()
Returns the current page number.
Returns
int page number
Edit.
OK, now (I think) I understand what you want to do, you add only 1 page and use auto page breaks, you also don't want to automatically number the pages in the footer. In that case you should use getAliasNumPage() and getAliasNbPages(). Define the following variable (edit the text as you will):
$PgNo= "This is the page " . $pdf->getAliasNumPage() . " of " . $pdf->getAliasNbPages();
Put it anywhere in the php document (it is important to put it after defining the fonts) and then just use the variable $PgNo (or however you will call it) wherever you need. You have to define it only once and it will later on get the values automatically depending on which page in the pdf document it is located.

The result of $this->getAliasNumPage() is NOT a number . It's... {:pnp:}
You can check this:
$text = "My Footer - Página ".$this->getAliasNumPage().'/'.$this->getAliasNbPages();
$this->Cell(0, 10, $text, 0, false, 'C', 0, '', 0, false, 'T', 'M');
And you will see the number.
But if you perform
echo $text;
you'll see the string doesn't have the number but only {:pnp:}
This came from the fact at this time (so when it executes the Footer function), the PDF is not yet created. So TCPDF can't know the number of pages. So it can't give you this value.
What can you do? in order to get a different footer eg on some pages, you must count the page number. So, declare a global $var at beginning of the Footer() function. Before the Footer() function, set $var to 0 and then, inside Footer() just $var++.
For the last page, just use this:
class mypdf extends tcpdf
{
// Declare for use in all function
protected $last_page = false;
// Will be called at the end
public function Close()
{
$this->last_page = true;
parent::Close();
}
public function Footer()
{
if ($this->last_page)
{
// Here you can display the footer for the last page
}
}
}
Edit: I forgot one option. If you want to know the full number of pages before the display or (eg) if you want to know the size of a PDF bloc to see if it fits a page and so on, you can use the rollbackTransaction();
First, you perform all operations (AddPages, MultiCell, and so on) which will give you the capability of the reading size of the result and all other values.
Then you perform a $pdf = $pdf -> rollbackTransaction(); which will "undo" everything and then you run all your functions again, using this time all the value you get from the "first run".

Related

Scrape E-Mails using IMAP without Exceeding Bandwidth

I have the following code which works great to do what it is meant to do. It scrapes bodys of all e-mails in the inbox at an e-mail address using IMAP and retrieves the unique code sent inside the body and stores it in a database with the amount paid. I'm hoping to make it so when a user purchases something they can send an Interac e-transfer and then enter the code that both of us receive via e-mail in the website and it will apply the credit of the e-transfer to their account/purchase.
However; after setting it up on a cron job to cycle every few minutes so the content in the database stays fresh it eventually exceeds the bandwidth for the account within a day or so (not positive on how long it took but it didn't take long). Now, like I said the code works it's just very resource intensive apparently.
I do not pipe the script because the e-mail account has already been set up a while ago and we do use the account for other e-transfers which I review manually for other transactions.
Is there anyway to clean it up so it works the same but uses less resources/bandwidth?
Would it be better to run it when a user enters their payment code? Depending on the number of users running it this could also lead to bandwidth troubles.
Is there any improvements or what ideas do you have?
define("MAX_EMAIL_COUNT", $_POST['maxcount']);
/* took from https://gist.github.com/agarzon/3123118 */
function extractEmail($content) {
$regexp = '/([a-z0-9_\.\-])+\#(([a-z0-9\-])+\.)+([a-z0-9]{2,4})+/i';
preg_match_all($regexp, $content, $m);
return isset($m[0]) ? $m[0] : array ();
}
function getAddressText(&$emailList, &$nameList, $addressObject) {
$emailList = '';
$nameList = '';
foreach ($addressObject as $object) {
$emailList .= ';';
if (isset($object->personal)) {
$emailList .= $object->personal;
}
$nameList .= ';';
if (isset($object->mailbox) && isset($object->host)) {
$nameList .= $object->mailbox . "#" . $object->host;
}
}
$emailList = ltrim($emailList, ';');
$nameList = ltrim($nameList, ';');
}
function processMessage($mbox, $messageNumber) {
global $db;
// get imap_fetch header and put single lines into array
$header = imap_rfc822_parse_headers(imap_fetchheader($mbox, $messageNumber));
$timestamp = strtotime($header->Date);
$fromEmailList = '';
$fromNameList = '';
if (isset($header->from)) {
getAddressText($fromEmailList, $fromNameList, $header->from);
}
$toEmailList = '';
$toNameList = '';
if (isset($header->to)) {
getAddressText($toEmailList, $toNameList, $header->to);
}
$body = imap_fetchbody($mbox, $messageNumber, 1);
//echo "<pre>".print_r($body,true)."</pre>";
/* Find Reference Number */
//echo "<pre style='background-color: #A2A2A2; border: 1px solid black'>$body</pre>";
$searchfor = 'Reference Number';
// get the file contents, assuming the file to be readable (and exist)
$contents = $body;
// escape special characters in the query
$pattern = preg_quote($searchfor, '/');
// finalise the regular expression, matching the whole line
$pattern = "/^.*$pattern.*\$/m";
// search, and store all matching occurences in $matches
if(preg_match_all($pattern, $contents, $matches)){
$reference = trim(str_replace('Reference Number : ','',$matches[0][0]));
}
else{
}
/* Find Amount Paid */
//echo "<pre style='background-color: #A2A2A2; border: 1px solid black'>$body</pre>";
$searchfor = 'has sent you a money transfer for the amount of';
// get the file contents, assuming the file to be readable (and exist)
$contents = $body;
// escape special characters in the query
$pattern = preg_quote($searchfor, '/');
// finalise the regular expression, matching the whole line
$pattern = "/^.*$pattern.*\$/m";
// search, and store all matching occurences in $matches
if(preg_match_all($pattern, $contents, $matches)){
$amount = trim(preg_replace("/[^0-9\.]/", "",$matches[0][0]),'.');
}
else{
}
$bodyEmailList = implode(';', extractEmail($body));
// Delete all messages older than one year (31557600 seconds). Divide it by two for six months.
if($timestamp < time()-31557600) {
if(imap_delete($mbox,$messageNumber)) {
/*echo "<strong>";
print_r($messageNumber . ' , ' . date("F j, Y g:i A",$timestamp).' , ' . 'Deleted' . "\n");
echo "</strong>";*/
}
}
else {
if(!empty($reference) && !empty($amount)) {
if($fromNameList == "catch#payments.interac.ca" && $toNameList!='etransfers#example.com') {
$query = "SELECT * FROM `".$db->prefix."payments_etransfer` WHERE `reference_id` = '".$reference."'";
$select = $db->select($query);
if($db->num_rows($select) > 0) {
}
else {
$do = $db->insert_sql("INSERT INTO `".$db->prefix."payments_etransfer` SET
`email_id` = '".$messageNumber."',
`timestamp` = '".$timestamp."',
`reference_id` = '".$reference."',
`amount` = '".$amount."',
`sender` = '".$fromEmailList."'");
if($do) {
}
else {
echo "Error<br><blockquote><pre>";
print_r($messageNumber . ',' . $timestamp. ',' . $reference . ',$' . $amount .
',' . $fromEmailList . ',' . $fromNameList
. ',' . $toEmailList . ',' . $toNameList
. ',' . $bodyEmailList . "\n"
);
echo "</pre></blockquote>";
}
}
}
}
}
}
// imap_timeout(IMAP_OPENTIMEOUT, 300);
// Open pop mailbox
if (!$mbox = imap_open($_POST['mailbox'], $_POST['login'], $_POST['password'])) {
die('Cannot connect/check pop mail! Exiting');
}
if ($hdr = imap_check($mbox)) {
$msgCount = $hdr->Nmsgs;
} else {
echo "Failed to get mail";
exit;
}
/* echo "<pre>";
echo 'emails count=' . $msgCount . "\n\n\n";
echo "record number,from emails list,from names list,to emails list, to names list,extracted from body\n";
*/
/* might improve performance according to
http://www.php.net/manual/en/function.imap-headerinfo.php#98809
imap_headers($mbox);
*/
for ($X = $msgCount; $X > 0; $X--) {
if($X > 0) {
processMessage($mbox, $X);
}
}
/*echo "</pre>";*/
imap_expunge($mbox);
imap_close($mbox);
/*

Variable Content Based on Parameter in Function

I'd like the have the output of the html return two possible markups based on a parameter the user can set. The parameter text_mode will be defined by the user by adding basic or advanced.
Right now, the $output is set for testing to show the basic version whereby the user's string is wrapped in a <p>. If the text_mode is set to advanced, then it's not wrapped.
<?php
function PCHiddenTextBlock( $settings = array() ) {
//---- Get Settings ----
//The functions default settings will be merged with what's passed in.
$settingsDefault = array(
'small_heading' => '',
'text' => '',
'text_mode' => 'basic', //or advanced
'color_scheme' => 'accent4',//accent4 or accent1
'container_id' => '',
'container_class' => 'x_extraContent',
);
$settings = array_merge($settingsDefault, $settings);
//---- Set Variables ----
//These will allow the markup build up to be as clean as possible.
//If container_id is set, prepare the attribute
$has_container_id = strlen($settings['container_id']) > 0;
$possible_container_id_attribute = ($has_container_id) ? " id='{$settings['container_id']}'" : "";
//Color scheme variables
switch($settings['color_scheme']) {
case 'accent1':
$gcol_color_class = 'bg-color-accent1-C';
$color_accent_class = 'color-accent1-8';
$hover_color_class = 'hover-color-base-4';
break;
default: //accent4
$gcol_color_class = 'bg-color-accent4-D';
$color_accent_class = 'color-accent4-A';
$hover_color_class = 'hover-color-base-4';
}
//---- Build Output ----
//Line by line, concatenating strings with new line and tab characters.
$output = "\n<!-- Hidden Text Block -->";
$output .= "\n<div class='{$settings['container_class']} gcol-1 {$gcol_color_class}'{$possible_container_id_attribute}>";
$output .= "\n\t<div class='padbox-standard-content'>";
$output .= "\n\t\t<h2 class='small-heading color-accent1-9'>{$settings['small_heading']}</h2>";
$output .= "\n\t\t<p>{$settings['text']}</p>"; // basic version
$output .= "\n\t\t<a href='' class='x_extraContentClose box-close-icon {$color_accent_class} {$hover_color_class}'></a>";
$output .= "\n\t</div><!-- padbox-standard-content-->";
$output .= "\n</div><!-- Hiddent Text Block -->";
//---- Return Output ----
return $output;
}
Just use an if statement:
if ($settings['text_mode'] == 'basic') {
$output .= "\n\t\t<p>{$settings['text']}</p>"; // basic version
} else {
$output .= "\n\t\t{$settings['text']}<"; // advanced version
}

Magento Sales/Order/Grid change color depending on status

I am overriding on my module the sales grid to get different reports and i was trying to set a different color if order status is "complete" etc.
Here is my approach , it is not giving errors but doesn't seem to work.
class Mycustom_Salesorderitemgrid_Block_Adminhtml_Order_Items_Grid_Renderer_Order
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
public function render(Varien_Object $row)
{
$value = $row->getData($this->getColumn()->getIndex());
$html ='<a href="' . $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getData('order_id'), 'key' => $this->getCacheKey())) . '" target="_blank" title="' . $value . '" >' . $row->getData($this->getColumn()->getIndex()) . '</a>';
return $html;
// here i am trying to add the color to mass status, after finding solution i will add seperate colors based on status
$truncateLength = 255;
// stringLength() is for legacy purposes
if ($this->getColumn()->getStringLimit()) {
$truncateLength = $this->getColumn()->getStringLimit();
}
if ($this->getColumn()->getTruncate()) {
$truncateLength = $this->getColumn()->getTruncate();
}
$text = Mage::helper('core/string')->truncate(parent::_getValue($row), $truncateLength);
if ($this->getColumn()->getEscape()) {
$text = $this->escapeHtml($text);
}
if ($this->getColumn()->getNl2br()) {
$text = nl2br($text);
}
if ($this->getColumn()->getStatusLabel() == array('processing', 'waiting', 'pending', 'almost', 'telephone')) {
$yesterday = strtotime("-24 hours", Mage::getModel('core/date')->gmtTimestamp());
$yesterday = Mage::getModel('core/date')->date(null, $yesterday);
if ($row->getCreatedAt() > $yesterday) {
$text = '<span style="color: red !important; font-weight: bold;">' . $text . '</span>';
};
}
return $text;
}
}
You need to add the method below to your Mage_Adminhtml_Block_Sales_Order_Grid class (or to the class which overrides it):
public function getRowClass($order)
{
if ($order->getStatus() == 'canceled') {
return 'red-row';
}
}
This code will add class="red-row" for every row where the order status is "canceled".
Hope that this will help

ModX Revolution Caching Dynamicly Generated Placeholders

How can I cache (using ModX's cacheManager), the dynamic placeholders i am generating here:
// recursive function to generate our un-ordered list of menu items
if(!function_exists('GenerateMenu')){
function GenerateMenu($level, $parent = 0, $wc, $wi, $we, $cs, $sc, $cl){
try {
$lvl = ++$level;
global $modx;
// Check for #1, should this be cached, #2 does it already exist in the cache
$cached = $modx->cacheManager->get('Navigator');
if($sc && isset($cached)){
// need to get the placeholders from cache - here somehow!
return $cached;
}else{
// get the site start
$siteStartId = $modx->getOption('site_start');
// Set our initial rows array
$rows = array();
// Run our query to get our menu items
$sql = 'Select `id`, `menutitle`, `uri`, `longtitle`, `parent`, `link_attributes`, `class_key`, `content`, `alias`, `introtext`
From `' . $modx->getOption(xPDO::OPT_TABLE_PREFIX) . 'site_content`
Where `deleted` = 0 AND `hidemenu` = 0 AND `published` = 1 AND `parent` = :parent
Order by `parent`, `menuindex`';
$query = new xPDOCriteria($modx, $sql, array(':parent' => $parent));
if ($query->stmt && $query->stmt->execute()) {
$rows = $query->stmt->fetchAll(PDO::FETCH_ASSOC);
}
// do some cleanup
unset($query, $sql);
// make sure we have some rows, and then build our html for the menu
if($rows){
// grab a count of our results
$rCt = count($rows);
$cls = ($lvl > 1) ? 'sub-item-' . $lvl : 'main-item-' . $lvl;
$ret .= ' <ul class="' . $cls . '" id="' . $cls . '-' . $parent . '">' . "\r\n";
for($i = 0; $i < $rCt; ++$i){
// if this resource is a WebLink, show the content in it, as the URL for the href tag, otherwise, use the resource's URI
$url = ($rows[$i]['class_key'] == 'modWebLink') ? $rows[$i]['content'] : '/' . $rows[$i]['uri'];
// Check for the site's start id, if true, show a "blank" link, otherwise show the $url
$showUrl = ($siteStartId == $rows[$i]['id']) ? '/' : $url;
$la = (strlen($rows[$i]['link_attributes']) > 0) ? ' ' . $rows[$i]['link_attributes'] : null;
// Set some dynamic placeholders, they can only be used ont he pages that contain this snippet
$modx->toPlaceholders(array('Title-' . $rows[$i]['id'] => $rows[$i]['longtitle'],
'MenuTitle-' . $rows[$i]['id'] => $rows[$i]['menutitle'],
'URL-' . $rows[$i]['id'] => $showUrl),
'link');
$ret .= ' <li class="' . $cls . '" id="' . $rows[$i]['alias'] . '">' . "\r\n";
$ret .= ' <a href="' . $showUrl . '" title="' . $rows[$i]['longtitle'] . '"' . $la . '>' . $rows[$i]['menutitle'] . '</a>' . "\r\n";
$ret .= GenerateMenu($lvl, $rows[$i]['id']);
// Check for a snippet, and render it
$it = $rows[$i]['introtext'];
if($cs && IsSnippet($it)){
// if we find a snippet in the Summary field, run it, and attach it to our output
preg_match('/\[\[!?(.*)\]\]/', $it, $sm);
$ret .= $modx->runSnippet($sm[1]);
// clean up
unset($sm);
}
$ret .= ' </li>' . "\r\n";
}
$ret .= ' </ul>' . "\r\n";
}
// clean up
unset($rows);
// Check to see if we should cache it, if so, set it to cache, and apply the length of time it should be cached for: defaults to 2 hours
if($sc){
// NEED TO SET THE PLACEHOLDERS TO CACHE SOMEHOW
$modx->cacheManager->set('Navigator', $ret, $cl);
}
// return the menu
return $ret;
}
} catch(Exception $e) {
// If there was an error, make sure to write it out to the modX Error Log
$modx->log(modX::LOG_LEVEL_ERROR, '[Navigator] Error: ' . $e->getMessage());
return null;
}
}
}
The easiest solution may be pdoTools which allows you to establish caching at run time.
http://www.shawnwilkerson.com/modx/tags/pdotools/
Also, I do not believe resource placeholders are cached which is the best place to have your items cahced:
case '+':
$tagName= substr($tagName, 1 + $tokenOffset);
$element= new modPlaceholderTag($this->modx);
$element->set('name', $tagName);
$element->setTag($outerTag);
$elementOutput= $element->process($tagPropString);
break;
From lines 455-461 of https://github.com/modxcms/revolution/blob/master/core/model/modx/modparser.class.php#L455
You may notice the other tag types have:
$element->setCacheable($cacheable);
I cover the parser in Appendix D of my book. I found some issues in it in 2011 which Jason corrected.
Move toPlaceholders() to the end of your script and instead cache the array of placeholder data:
// attempt to retrieve placeholders from cache
$placeholders = $modx->cacheManager->get('Navigator');
// if not in cache, run your snippet logic and generate the data
if (empty($placeholders))) {
$placeholders = array(
'myplaceholder' => 'placeholder data'
);
$modx->cacheManager->set('Navigator', $placeholders, $cl);
}
// set placeholders for use by MODX
$modx->toPlaceholders($placeholders);

Drupal Paging module doesn't show the number of pages

I am finishing some edits on a drupal project that was done by another programmer (I have no contact with him). I'm a newbie and trying to find out how the Paging module works. There are no numbers of pages showing. I suppose the programmer added some custom module or something.
I found a file named "pager.php" in the project's own theme folder with this function, that is probably doing the pagination:
function _my_pager_link($page, $text, $class, $title) {
$query = array();
$query[] = drupal_query_string_encode(array(
'page' => implode(',', $page)), array());
$querystring = pager_get_querystring();
if ($querystring != '') {
$query[] = $querystring;
}
$attributes['title'] = $title;
$attributes['class'] = $class;
return l("<span>$text</span>", $_GET['q'], array('html' => TRUE,
'attributes' => $attributes,
'query' => count($query) ? implode('&', $query) : NULL));
}
function my_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 5) {
global $pager_page_array, $pager_total;
$curr = $pager_page_array[$element];
$total = $pager_total[$element];
$output = '';
if ($total > 1) {
$output .= '<div class="pager">';
if ($curr > 0) {
$page_new = pager_load_array($curr - 1, $element, $pager_page_array);
$output .= _my_pager_link($page_new, t('‹ previous'), 'pager-prev', t('Go to previous page'));
}
if ($curr < $total - 1) {
$page_new = pager_load_array($curr + 1, $element, $pager_page_array);
$output .= _my_pager_link($page_new, t('next ›'), 'pager-next', t('Go to next page'));
}
$output .= '<div class="cleaner"></div>';
$output .= '</div>';
}
return $output;
}
Now there is just 'previous page' and 'next page' on the web. I would like it to be like this
'previous page '... 2 3 4 ... 'next page'
How can I add the list of pages there?
Thank You
Copy and paste http://api.drupal.org/api/function/theme_pager/6
Add salt and voila!
You need to set the global values like so:
global $pager_page_array, $pager_total;
$pager_page_array[0] = $your_page_count_goes_here;
$pager_total[0] = $your_page_total_goes_here;
And then you can call theme('pager', ...) or any custom paging theme function that you may have.

Categories