kiennguyen1101 Posted March 20, 2016 Share Posted March 20, 2016 Hi all, I need a page for users to post questions to moderators. I'm reusing the Discussions module and the Comment module for the replies (I didn't like the idea of having hundred of pages for replies so I modified it). To handle the form, the Discussions module to autoload in every pages and I think it could pose performance issue. So my question is: Is there anyway for a module to handle a submitted form without setting autoload = true? i.e. processwire loads the module on-demand. Link to comment Share on other sites More sharing options...
horst Posted March 20, 2016 Share Posted March 20, 2016 I don't think that you will get measurable performance diferences if one single module is autoloaded or not. You need to do early checks and returns, if it is (not) responsible for a request, so. If you want start it on demand, you can send the forms to a single page that is responsible for its processing. In the template you can invoke it on demand. But I think it isn't worth it. Link to comment Share on other sites More sharing options...
kiennguyen1101 Posted March 22, 2016 Author Share Posted March 22, 2016 I don't think that you will get measurable performance diferences if one single module is autoloaded or not. You need to do early checks and returns, if it is (not) responsible for a request, so. Thanks for the answer. if (count($this->input->post) <= 0) return false; // Process new post $this->processInput(); Another thing regarding form handling in autoload module is: I cannot add before hook to the ready function of the module (I added tripple underscore ___) as well as the form handling function it calls.This is because I want to separate template and module logic and not modifying directly to the code of the module. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now