alexeld Posted September 14, 2013 Share Posted September 14, 2013 Hi folks, I'm new to ProcessWire, and I'm currently evaluating it for use in an upcoming project. The reviews and write-ups I've read online have said great things about it, and from what I've seen so far, I'm really rather impressed. I've spent a lot of time using Laravel, CodeIgniter, and CakePHP, all of which make use of the MVC pattern, however, PW doesn't do this, and therefore I'm looking for some advice on how best to structure my PW applications... Reading around, I've found some write-ups which cover form handling and validation, but I'm unsure quite *where* these files should live, and I'd love some advice on how best to structure my application. Do I create a template which contains form-handling code *and* HTML (all in the same file -- like "classic PHP"), or can I separate my form handler/validation code from my markup (and have the HTML form post to a PHP script somewhere else)? Or maybe there's another way (perhaps using Modules) that I'm unaware of? If it helps, I'm /usually/ the "backend guy" on the projects I tend to work on, and I work closely with front-end chaps (designers mostly) who throw together the HTML, so if there is a way to keep the markup and processing logic loosely coupled, I'd love to hear about it! Anyway, thanks for taking the time to read this, and I really would appreciate any wisdom you kind people have to offer. Many thanks! 1 Link to comment Share on other sites More sharing options...
diogo Posted September 14, 2013 Share Posted September 14, 2013 Welcome to PW alexeld, PW doesn't impose any way of structuring your files, so you are free to use any way that you prefer. I think you will find this thread very clarifying http://processwire.com/talk/topic/740-a-different-way-of-using-templates-delegate-approach/ Link to comment Share on other sites More sharing options...
pwired Posted September 15, 2013 Share Posted September 15, 2013 Hi Alexeld, You can find more threads here about templates, backend, frontend, etc. http://processwire.com/talk/topic/4173-grouped-forum-posts-links-articles-tutorials-code-snippets/ Link to comment Share on other sites More sharing options...
ryan Posted September 15, 2013 Share Posted September 15, 2013 I've spent a lot of time using Laravel, CodeIgniter, and CakePHP, all of which make use of the MVC pattern, however, PW doesn't do this, and therefore I'm looking for some advice on how best to structure my PW applications... Since you are comfortable with using the MVC pattern, this may be the way you want to go in ProcessWire too. ProcessWire is very much supportive of the MVC pattern, it's just that it doesn't require it. ProcessWire is providing your models, your template files provide your controllers, and you provide the views with the TemplateFile class (or some other view loader of your own if preferred). You can also choose to target some template files/pages as views and call $page->render() on them. If you are interested, the Blog profile does use an MVC-style approach and would be worth looking at. But after you spend some time with ProcessWire, I recommend finding the approach that best suits a particular situation rather than locking yourself down to using the same one all the time. ProcessWire is giving you a lot more in some areas than a typical MVC framework does, so you may find even faster and more maintainable ways to structure your code, depending on the situation. 4 Link to comment Share on other sites More sharing options...
alexeld Posted September 15, 2013 Author Share Posted September 15, 2013 Hi Chaps, First of all: thank you all ever-so much for getting back to me! There's a mountain of great advice from each of you for me to start working through, and I really do appreciate it. ... after you spend some time with ProcessWire, I recommend finding the approach that best suits a particular situation rather than locking yourself down to using the same one all the time. I had started to get a sense that ProcessWire was accommodating of various development methods, and it's actually quite refreshing to find a framework which *doesn't* enforce a strict development methodology. Suffice it to say, I'm looking forward to getting stuck in to developing my little test application to figure out which method here best suits my needs. You guys have been great. Thanks again for all the input! Cheers! 1 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