I have an application using Jquery's UI Tabs for an overall menu, and they're great. However, I've come to a strategy question when implementing the new format.
First, the concept:
- An index.php file includes several class files (also PHP) and calls the tabs
- Each tab pulls in one file per page via the script's "ajax loading" feature (As described here)
- Each tab's page contains a combination of static text, content loaded server-side at display, and content that's dynamically updated via jQuery's Ajax.
Now, the challenge: Everything is working as expected except that pages that are pulled into the tabs don't have access to the aforementioned included php files on the index page. I'm able to use that content if 开发者_如何学PythonI do a separate includes on each of the ajax included pages, but that could get out of hand in a hurry. So, I'm seeking a strategy to get one set of included files to persist across all my pages.
Any ideas for a graceful solution to this challenge?
PHP (well, the entire web) is stateless, meaning once the PHP interpreter has parsed a file, it spits it out and is done with it. There is no way for it to persist includes parsed in one instance to another instance.
The only way for the pages to gain access to files included in the "main" page is to include those files themselves. Like you said though, that could get out of hand and be pain-staking to maintain, which is why a lot of people resort to a registry file. Your registry file loads the includes you need, and you only need to include the registry file on all of your pages.
精彩评论