hi sam
i think i made things even more confusing in my post.
I am just ttrying to accomplish plain ajax in multiple pages.
Suppose I have 3 pages
a.html
b.html
c.html
And they all in some form have an 'Article' model in them.
I want to rate the article (i.e. /Article/rate/<article_id>/<rating>)
for instance on any of these pages and then update a DIV on any of those
pages.
HOWEVER suppose in my cake controller....
ArticlesController() {
function rate() {
///...
/// ....
$this->set('rating',$rating);
}
}
If i use this using ajax helpers it complains that I have no view file
rate.ctp. What I want to do is have this method just return so it can be
used in any ajax/html context it is used. The only examples I have seen
have something like this:
function rate() {
///...
/// ....
$this->set('rating',$rating);
$this->render('index'); // To foward back to the page it came from
}
which seems kludgy.. Maybe I should use a component that can be called
from anywhere instead of the controller?!?!
thanks
m
Sam Sherlock wrote:
> As I understand the example of virtual attributes in rails (that link
> being the only basis of info) it concats two fields depending on
> certain things (eg spaces in the names)
>
> so virtual attributes perform set routines on data under certain
> circumstances. without know what you want these *custom properties*
> to *do* and without knowing the ins and outs of rails its really hard
> to say.
>
> I believe that whatever your trying to accomplish can be achieved with
> cake but unless you explain what your trying to achieve any answer may
> well be misleading.
>
> so what are you trying to accomplish?
>
> 2008/8/28 trustfundbaby <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
>
>
> At the risk of repeating myself, I am looking for something that works
> the same way as virtual attributes in rails.
>
>
>
> On Aug 28, 2:25 pm, "Sam Sherlock" <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> > models have behaviours
> >
> > controller have components
> >
> > and views have helpers
> >
> > also you can add a function to the appmodel and then all models
> have access
> > to it
> > there is an example that shows this on the link to book you posted.
> >
> > 2008/8/28 trustfundbaby <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>>
> >
> >
> >
> > > I guess I'm talking more along the lines of virtual attributes in
> > > Rails.
> > >http://railscasts.com/episodes/16
> > > I just called it custom properties because thats what its
> called here
> > > (although there are no examples)
> > >http://manual.cakephp.org/view/72/custom-methods-and-properties
> >
> > > On Aug 28, 8:19 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> > > > I don't get what you mean with "custom properties". Maybe
> it's just me
> > > > but, can you elaborate a bit more please?
> >
> > > > On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby
> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
> > > wrote:
> >
> > > > > How do you specify custom properties in a CakePHP model?
> > > > > I'm trying to do this, but there is no sample code any
> where that
> > > > > shows how its done, can someone point me in the right
> direction?
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---