It probably is a $ conflict.

Try assigning $j or something like that to the JQuery var and see if it
resolves your problem.

For reference : http://docs.jquery.com/Using_jQuery_with_Other_Libraries

On Tue, Oct 6, 2009 at 12:15 AM, hahmadi82 <[email protected]> wrote:

>
>
> Nevermind, I got it all to work.  Thank you guys a ton!  I learned so much
> and I finally achieved what I was looking for.  One last question if it's
> not too much a bother... Our website uses JQuery and for this ajax
> observeField thing to work I use a javascript->link('prototype').  However,
> if prototype is enabled, all the JS doesn't work.  Any ideas how I can get
> these two to work together?  I read about conflicts with $ but it doesn't
> seem to apply in my case.
>
>
> brian-263 wrote:
> >
> >
> > Put the select widget in an element. Get the select options with
> > requestAction(). And cache the options so you don't have to fetch them
> > from the DB each time.
> >
> > You don't need to change the target of the AJAX call. It doesn't
> > matter what view you're in. It's just like any other link.
> >
> > On Sat, Oct 3, 2009 at 3:06 PM, hahmadi82 <[email protected]> wrote:
> >>
> >>
> >> Yea, probably much easier for me to explain what I've done and what I'd
> >> like
> >> to do.
> >>
> >> So basically I implemented the ajax select box using the code below:
> >>
> >>
> http://www.devmoz.com/blog/2007/04/04/cakephp-update-a-select-box-using-ajax/
> >>
> >> My code set up is more less the same as the example posted in that
> >> article.
> >> The ajax select box I created allows a user to select a car make, then
> >> year,
> >> then model.  Currently, I have this working in index.ctp just like the
> >> example, and the ajax calls the update_select.ctp.
> >>
> >> What I would like to do, is move this ajax selector into my navigation
> >> bar
> >> so that the user can change is car at any point during his browsing
> >> experience.  This means that no matter what view he's on, he can still
> >> use
> >> my ajax selector through the navbar.
> >>
> >> The complication is that my code is in my car_controller "index.ctp" and
> >> uses "update_select.ctp" with observefield (like the example).  I want
> to
> >> somehow move this code/functionality into my default.ctp.  Perhaps you
> >> guys
> >> can suggest the best strategy?  Even if I move the code from index.ctp
> to
> >> default and access the set variable from the app_controller before
> filter
> >> (as suggested), I still have the issue of ajax having to call the
> >> update_select function which I have no idea where I would move it to
> >> (perhaps in the app_controller?)...
> >>
> >> I apologize for the constant questions and greatly appreciate the help
> >> you
> >> guys have been giving me :)
> >>
> >>
> >>
> >>
> >>
> >> And then we scroll back 15 emails :
> >>
> >>
> >> If this works, then I would suggest to add your layout data to the view
> >> inside the beforeFilter() method of AppController and then use this data
> >> in
> >> your layout. Might even consider creating an element for the part that
> >> uses
> >> this data ...
> >>
> >>
> >>>
> >>> :)
> >>>
> >>> On Sat, Oct 3, 2009 at 10:34 AM, Miles J <[email protected]>
> >>> wrote:
> >>>
> >>>>
> >>>> Do it in the beforeFilter() of your AppController, that will apply it
> >>>> to all views and layouts.
> >>>>
> >>>> On Oct 3, 1:18 am, hahmadi82 <[email protected]> wrote:
> >>>> > Now I see!  So the set variables change depending on which view is
> >>>> showing
> >>>> > within the default.ctp.  If I add this car action to the
> >>>> app_controller
> >>>> > (instead of car model) and set the variables there, will all the
> >>>> views
> >>>> have
> >>>> > access to that variable? How can I make a global "set" variable that
> >>>> comes
> >>>> > from a specific query?
> >>>> >
> >>>> >
> >>>> >
> >>>> > brian-263 wrote:
> >>>> >
> >>>> > > On Fri, Oct 2, 2009 at 10:55 PM, hahmadi82 <[email protected]>
> >>>> wrote:
> >>>> >
> >>>> > >> Ok so I actually didn't create a layout for each view from my
> >>>> > >> controllers.
> >>>> > >> Instead, all the views use the same layout, which is the
> >>>> default.ctp.
> >>>> Is
> >>>> > >> that incorrect? From my understanding, the default layout is
> >>>> loaded
> >>>> by
> >>>> > >> every
> >>>> > >> view and that's why I have my navigation bar in it.  It seems
> that
> >>>> I
> >>>> can
> >>>> > >> only access those "set" variables from something like
> >>>> > >> views/layouts/cars/index.ctp but not views/layouts/default.ctp.
> Is
> >>>> there
> >>>> > >> a
> >>>> > >> difference between the model layouts and the default layout?
> >>>> >
> >>>> > > You *almost* have it. Once again:
> >>>> >
> >>>> > > When a controller's action is run, its render() method is called
> >>>> > > automatically (yes, you can call it yourself but please ignore
> that
> >>>> > > for now). When that happens, Cake will use the View class to
> render
> >>>> > > the view template for that action. These templates are in
> >>>> > > app/views/controller_name_ending_in_s/action_name.ctp
> >>>> >
> >>>> > > Usually, the view template contains some HTML that you have
> >>>> included,
> >>>> > > along with some variables. Those variables are passed to the View
> >>>> > > class through the controller's $viewVars class variable. When you
> >>>> call
> >>>> > > $this->set('foo', 'bar'), you are passing the value, 'bar' to the
> >>>> > > controller's $viewVars array with a key, 'foo'.
> >>>> >
> >>>> > > When the controller's $viewVars is handed off to the View class,
> it
> >>>> > > extracts them, essentially creating a var named $foo that contains
> >>>> the
> >>>> > > value 'bar'.
> >>>> >
> >>>> > > Now, after the View has finished using the view template to render
> >>>> > > something to output it creates a variable called,
> >>>> $content_for_layout.
> >>>> >
> >>>> > > It then renders the layout template. That's a file in
> >>>> > > app/views/layout/name_of_your_layout.ctp. If you don't specify a
> >>>> > > layout, Cake uses 'default'.
> >>>> >
> >>>> > > Inside the layout template is (should be) a variable named ...
> >>>> > > $content_for_layout. This is where the contents of your rendered
> >>>> view
> >>>> > > are written to the layout.
> >>>> >
> >>>> > > So, try this: In one of your controller actions, add
> >>>> $this->set('foo',
> >>>> > > 'bar');
> >>>> >
> >>>> > > In your app/views/layouts/default.ctp add this, just above
> >>>> > > $content_for_layout
> >>>> >
> >>>> > > echo $foo;
> >>>> >
> >>>> > > You should see 'bar' in there, somewhere. View source and search
> >>>> for
> >>>> > > it, because your CSS may hide it.
> >>>> >
> >>>> > > Anyway, perhaps you should post the relevant part of your layout
> >>>> file
> >>>> > > and the controller action.
> >>>> >
> >>>> > --
> >>>> > View this message in context:
> >>>>
> http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2572...
> >>>> > Sent from the CakePHP mailing list archive at Nabble.com.
> >>>> >
> >>>>
> >>>
> >>> >
> >>>
> >>>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25731765.html
> >> Sent from the CakePHP mailing list archive at Nabble.com.
> >>
> >>
> >> >
> >>
> >
> > >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25757183.html
> Sent from the CakePHP mailing list archive at Nabble.com.
>
>
> >
>

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

Reply via email to