|
|||
|
I'm trying to push a site of mine out of my own mess of a MVC Framework into Zend, but sadly i have still to learn it
![]() I've got the basis of my application down and am just looking at a simple way of creating some of the static elements of my site. Let say we have the following three pages Quote:
What i would like to do is be able to create them dynamically via the index controller some how? I think i should be looking at using __call(__call($id, $arguments) within my IndexController along side some static routes?! Can anyone point me in the right direction please. Last edited by Phunky : 04-17-2008 at 11:52 AM. |
|
||||
|
You want custom routes. See:
Zend Framework: Documentation and Zend Framework: Documentation (The whole thing)
__________________
Zend Framework Resources: Zend Webinars | Reference Manual | API Docs | Books | FreeNode: #zftalk Getting Started Tutorials: Getting started with ZF | Getting started with Zend Auth |
|
|||
|
I've been reading over both of them and still cant seem to grasp it correctly, it still seems very very anal about things.
Sure if i setup three differnt routes for each of the above pages it will work but i would like to be able to point it at just the one controller and if the action is there use it and if not just throw it an error. I just cant seem to grasp this framework at all :/ |
|
||||
|
Typically you would in fact setup three seperate routes. You can do that with config files once you get your head around it.
You could also accomplish your second option though it would be a bit more convoluted. Have you tried Akrabat's tutorial? It seems to get people going pretty quickly. Link in my sig.
__________________
Zend Framework Resources: Zend Webinars | Reference Manual | API Docs | Books | FreeNode: #zftalk Getting Started Tutorials: Getting started with ZF | Getting started with Zend Auth |
|
|||
|
Yeah i've read through Akrabat's tutorial and it was a great for understanding the basics of the framework.
I guess i will just have to give in and setup differnt routes for each of them - just seemed a bit of an over kill as there all going to point to the same Controller and just fire a differnt View depending on the Action called. I thought i read somewhere that you could use the __call() function for something similar with custom error reporting but cant find where i read it. |
|
||||
|
yes you could use __call() there is some doc on __call() in the errorHandling section of the contoller docs as well as php.net/manual/en/. Problem with that is it would have to be setup for each and every controller that you want static routes for. The custom route is more portable as __call() is frequently defined in custom base controllers. Where as custom routes place no constraints on the base controller classes. So if I were to import your controller into my app, or you were to import the same contoller into another app, you'd risk colliding with another definition of __call().
__________________
Zend Framework Resources: Zend Webinars | Reference Manual | API Docs | Books | FreeNode: #zftalk Getting Started Tutorials: Getting started with ZF | Getting started with Zend Auth |
|
|||
|
Well for the use i think __call() would be ideal for me as all the Static routes would be going through the same IndexController().
I've given up for today as its 5pm and i must leave the office on time will have a look in more depth tomorrow.Really dont want to give up on ZF but i cant spend much too much time getting to grips with it atm... |
|
||||
|
You can usually get a good response on freenode: #zftalk. There are lots of skilled people familiar with ZF hanging about waiting for questions to answer. I usually ask there first then post stuff here.
__________________
Zend Framework Resources: Zend Webinars | Reference Manual | API Docs | Books | FreeNode: #zftalk Getting Started Tutorials: Getting started with ZF | Getting started with Zend Auth |
![]() |
| Thread Tools | |
| Display Modes | |
|
|