2008年8月22日星期五

Re: [fw-mvc] Virtual Controllers

That's actually perfect. LIFO will surely do the trick. Thanks for the help.
Much appreciated!

On Fri, Aug 22, 2008 at 11:29 PM, #### wrote:

Hi,

I'm not sure if this would fit for your problem. But if you have a
unique identifier to query against the database to get a page, you could
just create a page controller with a show action. The router would look
something like new Zend_Controller_Router_Route_Regex('(.+)', array(
'module' => 'module', 'controller' => 'page', 'action' => 'show' ), array( 1
=> 'page' )); Adding that to the router first (bc of the LIFO order)
anything that isn't already routed will be routed to the page controller,
show action. In the show action you can query that database for the page
variable and return the page. If the query returns null, then forward the
controller to your file not found action in your error controller. Sorry if
this doesn't match your situation and good luck!

Regards,

####


jkush1121 wrote:
>
> I'm currently working on several different migration projects into the new
> framework, and am having some difficulty wrapping my brain around this
> specific functionality.
>
> We have several orphaned html files which need to be reassessed,
> regrouped, and reworked ( within various projects ) . I'd like to
> implement a simple CMS type functionality which could do the following,
> for instance:
>
> Page: Ask us a question ( interpreting into module/department/ask/index
> for mapping ).
>
> The page itself will be moved to the DB, leaving me with a unique
> identifier of department/ask/index to query against. My thought process
> includes:
>
> 1.) Using __call to create a virtual action handler to process the request
> as if it were a true action within a controller ( i.e. indexAction within
> askController ).
>
> 2.) Mapping all requests to a core controller for processing ( so that way
> I can create a virtual AskController without running into a conflict over
> file not found ).
>
> 3.) Create a router to handle various requests.
>
> Sorry if the description isn't explicity detailed, but this is about as
> far as Ive gotten. My problem is, I don't want to have all my requests get
> ported through a core controller which then forwards along. There are
> several controllers already implemented that shouldnt need to be first
> handled by a main controller due to this virtual theory.
>
> My best idea would be through routing, however the db-pages are dynamic in
> all nature. I won't have a standard identifier to perform a regex
> expression against, and Id prefer not to create a new router for each page
> being stored within the database.
>
> Once again, I apologize if this posting is a bit back and forth, but
> that's just how I feel at the moment. Anyone have any ideas?
>

--
View this message in context: http://www.nabble.com/Virtual-Controllers-tp19118385p19118455.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: