Monday, October 4, 2010

Re: Best way to handle sub-tabs

In retrospect, I guess I didn't explain as well as I should have.

I have each subtab as an element now and every subtab is rendered via
ajax (i.e. $js->link ($html->tag ('span', $side_button
['title']),
array ('action'=> 'display/'.$side_button ['name']), $options). The
controller action "display" just has a $this->render ("/elements/
$tabname/$whatToDisplay");

So, when the user goes to http://system/tabname, the initial view sets
up the element specific to that tab that views/layouts/default.ctp did
not setup. Each subtab element just has stuff specific to that subtab
(in my case, mainly just text).

However, I'd like people to go to http://system/tabname/subtab and
directly render the specific text to that subtab. That's what I can't
figure out??

Anyway, does this sound right to everyone? I feel like I am the only
one having this problem on something which seems pretty common (tabs/
subtabs). Is there a better way of doing the above? I'd welcome all
ideas!

Thanks for the response!
Joey

On Oct 1, 1:49 pm, Miles J <mileswjohn...@gmail.com> wrote:
> Just use the default MVC architecture?
>
> tabname = controller
> subtab = action
>
> On Sep 30, 12:05 pm, Joey Mukherjee <joe...@gmail.com> wrote:
>
>
>
> > I have some tabs along the top of my CakePHP site and some sub-tabs
> > along the left side of my page.  When I switch tabs, it goes to a URL
> > such ashttp://system/tabname.  When I go to a sub-tab, I use $this->render to update the content of the view to what the user clicked
>
> > on.  However, I'd like a URL such ashttp://system/tabname/subtabto
> > go directly to the subtab.
>
> > How might I accomplish this?  Basically, I want to redirect to tabname/
> > index and then render the subtab.
>
> > My tabname index view sets up the side menu.  The subtab just modifies
> > the inner content.  The views/layouts/default.ctp has the top tabs
> > defined in them.  Obviously, the side tabs change from tab to tab.
>
> > Hope that makes sense!
>
> > Thanks,
> > Joey

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: