PHP Link Handling
Can anybody tell me a way to make clicking on a link in a PHP-generated page execute a function in the PHP script instead of loading a new page?
I'm redesigning my website from the ground up as an object-oriented PHP project. I want index.php to require page.inc, with the source code to class page, set a few variables, and then call the display() method of class page. When the user clicks a link, I want the script to load the new content from a MySQL database and then call display() again--Hence the header, footer, and other static content is unchanged, but the new content is displayed in a table frame at the center of the page. Since I'll be keeping downloads and images for each section in a separate directory, just making a whole bunch of nearly identical "index.php" files is a pain in the hole--especially since loading a new index.php requires a new connection to the database! Why terminate a script and start an identical one when I can just keep running the same script? |
Well you can actually run the same script you know. A simple example on how to go around these things:
You create that index.php, and make it look like this, for example (assuming you've already done your PHP connection and there's a field 'article' and 'articlename' in a table 'tblContent': PHP Code:
|
All times are GMT -5. The time now is 04:38 AM. |