I figured out out guys. The reason was there were some syntax errors
in other parts of the code (in my case, a ClassnameComponent was named
as ClassnameHelper), due to which this part of the code wasn't getting
executed.

Also, I shifted all the 'set's to beforeRender(). I was using a few of
these varnames in other views as well, so they ended up getting
overwritten.
I later fixed this by renaming the view-copy of these variables
differently.

Thanks for your time!

On Jul 10, 2:31 pm, euromark <dereurom...@googlemail.com> wrote:
> well,
> beforeFilter() is not always triggered
> why not putting everything in beforeRender()
> would make more sense to me
>
> by the way:
> for some data you can always use Configure::write() and
> Configure::load()
> might make sense if you want to use it in different locations
>
> On 10 Jul., 10:00, runckel <robhueb...@web.de> wrote:
>
>
>
> > Hi,
>
> > i dont see anything wrong there, so i would first write a $this-
> > log($login_url) in the app controllers beforeRender to be sure it will
> > be called and the $login_url is filled. One reason it will not be
> > called could be a beforeRender in the calling Controller whitch doesnt
> > call his Parent.
>
> > On 8 Jul., 22:25, Angad Nadkarni <angad.nadka...@gmail.com> wrote:
>
> > > I am setting variables in AppController in order to use them in
> > > default.ctp.
>
> > > This is my code:
>
> > >         function beforeRender ( )
> > >         {
> > >                 @Controller::loadModel('User');
> > >                 $login_url = [trimmed];
> > >                 $this->set('loginurl', $login_url);
> > >                 $this->set('user', $this->Cookie->read('User'));
> > >                 $this->set('examdata', $this->User->query('select listing 
> > > from exams
> > > limit 0,1'));
> > >                 $this->set('exam', $this->Cookie->read('exam'));
> > >         }
>
> > > The logic for above code has been performed in beforeFilter().
>
> > > Now when I use the variables in default.ctp, such as say $loginurl, or
> > > $examdata, I get:
>
> > > Undefined variable: loginurl
>
> > > or Undefined variable: examdata
>
> > > What am I doing wrong?- Hide quoted text -
>
> - Show quoted text -

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to