The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
php code in template for pagination
I have this chunck of code with for statements. I need to bring that in template because I want to display those those link near mod. Right now it is displaying at top of page like 1 2 3 4,.Links are working fine with currentpage no link. Code is working but it is displying on top since it is in php page all the records are in template.
I want to display the links near mod. the only way I can do is I have to bring this below code with for statements and links to display the current page and all other pagelinks. Please can anyone can guide me, how can we display near section with if conditions. $numofpages = $totalrows / $limit; for($i = 1; $i <= $numofpages; $i++){ if($i == $page){ echo($i." "); $currentpage= $i." "; }else{ echo("<a href=\"$PHP_SELF?page=$i\">$i</a> "); } } $totallimit=$totalrows % $limit; if(($totalrows % $limit) != 0){ if($i == $page){ echo($i." "); //$currentpage = $i; }else{ echo("<a href=\"$PHP_SELF?page=$i\">$i</a> "); } } I'll provide more details if needed I really appreciate, if I get any help on this. Thanks |
#2
|
|||
|
|||
You can not use PHP in templates, they are HTML only.
See the following on the basics on how to include data using plugins: Including External Files |
#3
|
|||
|
|||
Thanks for reply marco.
I did exactly what you suggested. Now links are displaying on top of module, but I have one more problem. I am pretty sure Proffesional like you can help me with this. 1 2 links are displaying properly but when i click on 2nd page link - page is displaying with correct results and link is not going back to No 1 link.link still stays for No2. I cannot go to No1 page. Actually with php page when I click on No2 link. Link should go away for No2 and link should come for No1. Is there any way can we go back to include file to get the new link. Can you please help me with if statement that can go back to include.php to change the links so I can switch between pages. I really appreciate your help Thanks |
#4
|
|||
|
|||
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 |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|