PDA

View Full Version : looping does not work from template to php included


reddyink
12-04-2007, 07:54 PM
I created a plugin to pointing to a new php file with pagination display code and added variable $included in template. Display is working fine with 1st page resullts and all other links. When I click on second page results are showing fine but hyperlink is still showing for 2nd page and no link for 1st page. I cannot go back to 1st page.
I am guessing, I have to write a If else code in my template or plugin. Can you please help me on that.

I think when page first loads it is working because Since $included variable has values that needs to display . For pagination links it is not going back to php page for following statement.
for($i = 1; $i <= $numofpages; $i++)

Thsi is the php code for pagination in my new php file-mypagination.php
$numofpages = $totalrows / $limit;

for($i = 1; $i <= $numofpages; $i++){
if($i == $page){
echo($i." ");
}else{
echo("<a href=\"$PHP_SELF?page=$i\">$i</a> ");
}
}

if(($totalrows % $limit) != 0){
if($i == $page){
echo($i." ");
}else{
echo("<a href=\"$PHP_SELF?page=$i\">$i</a> ");
}
}

plugin code:

ob_start();
include('C:/program files/EasyPHP 2.0b1/www/upload/vba_dyna_modules/mypagination.php');
$includedphp = ob_get_contents();
ob_end_clean();

Used $includedphp in template to display. Display is working fine with correct results on each page.
When i click on 2nd page, results are second page results but first page does not have link. the display stays the same. Actually 1st page should have link now not 2nd page.
How to go back to php page to get new display.

I have been working on this from 1 week. I'll really appreciate any kind of help.
Thanks