Controller and pages/views
Permalink
Hi Guys,
I'm still new to concrete 5 and starting to play around with custom scripts and stuff.
For Controllers, is it just a controller per page?
This is what I want to do:
Right now it seems like it's all going to the same view where you can check for different actions. This isn't a big deal, but it can make a single view file disorganized for larger applications.
Cheers,
-Derek
I'm still new to concrete 5 and starting to play around with custom scripts and stuff.
For Controllers, is it just a controller per page?
This is what I want to do:
class SomeController extends Controller { function view() { // goes to view page } function other_function() { // goes to other_function page } }
Right now it seems like it's all going to the same view where you can check for different actions. This isn't a big deal, but it can make a single view file disorganized for larger applications.
Cheers,
-Derek
Try something like this
And put a file in single_pages/some/other_function.php
class SomeController extends Controller { function view() { // goes to view page } function other_function() { // do the view code here $this->render('/some/other_function'); } }
And put a file in single_pages/some/other_function.php
Thanks for the help guys.
matogertel: Thanks man! That in deed works.
ChadStrat: I'm not talking about a page type for a theme. More like different pages for message forum. I'm not buildng a forum, just an example:
view post, reply to post, create a post, list posts.
I would want all of those to have seperate php files for the view but all using the same controller.
matogertel: Thanks man! That in deed works.
ChadStrat: I'm not talking about a page type for a theme. More like different pages for message forum. I'm not buildng a forum, just an example:
view post, reply to post, create a post, list posts.
I would want all of those to have seperate php files for the view but all using the same controller.
ahhh. I see. thanks for sharing. this is helpful indeed!
as an example: you might want the header shown in your default view, and then a thin banner on subpages that has some random script that needs called.
so you would create a new page type in your templates dir for subpage, and then call the random script in that template. $controller->randomscript();
one controller, two page types. if I understood you correctly. or to your point, just if/else the daylights out of one view file. lol