Support » Themes and Templates » PHP code in a page template – cannot reference the same page.

  • Hi,
    I have embeded a PHP script into my page template. This script fetches records from a DB and displays the records. It displays 10 records per page. To test the script , i added 12 records. The first 10 displayed fine. I got a ‘Next Page” link, but this link points back to index.php!
    How can i reference the same page in the next link? So the page that has the script, you want on clicking next to come back to it because it has the code to display the next set of records.
    So if the page was called page.php, you provide a ‘Next’ link that appends additional information to page.php so that second time around, it only displays the records for that page.
    How can i do this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I think you should be more specific in order to get an answer.

    Ok, will explain.

    I have a page and in the template, I have added a form that submits to itself. Also in the page template is the code that handles the form submission. This code retrieves and displays the results. Only 10 records are displayed and links created for page 2, 3 and so on of the results.

    The links for the other pages are dynamically constructed by appending the submitted form data. The code uses
    $_SERVER[‘PHP_SELF’]?searchSubmit=true&page=2&searchName=somevalue&searchState=somevalue&searchRating=somevalue

    The problem is $_SERVER[‘PHP_SELF’] gives index.php. I want it to reference the page with the template code. How can I add that reference to the page?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP code in a page template – cannot reference the same page.’ is closed to new replies.