Saturday, January 29, 2011

Re: Helper File

No as I said am new here I am following this tutorial:
http://www.ibm.com/developerworks/opensource/tutorials/os-php-cake1/section4.html

this page is where helpers were introduced.

Thanks

On Jan 29, 12:27 am, Sam Sherlock <sam.sherl...@gmail.com> wrote:
> strange. Looks fine
>
> and you have not edited the core at all?
>
> Maybe I am missing something.
>
> On 29/01/2011, newguy <aimanparv...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > yes thats line 3
>
> > On Jan 29, 12:15 am, Sam Sherlock <sam.sherl...@gmail.com> wrote:
> >> echo $html->tableHeaders
> >> (array_keys($knownusers[0]
> >> ['User']));
>
> >> is that line 3
>
> >> On 29/01/2011, newguy <aimanparv...@gmail.com> wrote:
>
> >> > hey Sam
> >> > I made the change but still I get teh following error:
>
> >> > Notice (8): Undefined property: View::$Html [APP/views/users/
> >> > knownusers.ctp, line 3]
>
> >> > Fatal error: Call to a member function tableHeaders() on a non-object
> >> > in /Applications/MAMP/htdocs/cake_1.2.5/app/views/users/knownusers.ctp
> >> > on line 3
>
> >> > this is my controller code:
> >> > <?php
> >> > class UsersController extends AppController
> >> > {
> >> >    var $name='Users';
> >> >    var $helpers = array('Html','Form');
>
> >> >   function register()
> >> >   {
> >> >     if (!empty($this->params['form']))
> >> >     {
> >> >       if ($this->User->save($this->params['form']))
> >> >       {
> >> >         $this->flash('Your registration information was
> >> > accepted.','register');
> >> >       } else {
> >> >         $this->flash('There was a problem with your registration', '/
> >> > register');
> >> >       }
> >> >     }
> >> >   }
>
> >> > function knownusers()
> >> > {
> >> > $this->set('knownusers',$this->User->findAll(null, array('id',
> >> > 'username', 'first_name','last_name'), 'id DESC'));
> >> > }
>
> >> > }
> >> > ?>
>
> >> > Thanks
>
> >> > On Jan 28, 11:57 pm, Sam Sherlock <sam.sherl...@gmail.com> wrote:
> >> >> On 29/01/2011, Jeremy Burns | Class Outfit
> >> >> <jeremybu...@classoutfit.com>
> >> >> wrote:
>
> >> >> > What version of Cake are you using?
>
> >> >> > The Html helper is available out of the box. Have you declared any
> >> >> > other
> >> >> > helpers in your controller?
>
> >> >> > Jeremy Burns
> >> >> > Class Outfit
>
> >> >> > jeremybu...@classoutfit.com
> >> >> >http://www.classoutfit.com
>
> >> >> > On 29 Jan 2011, at 07:44, newguy wrote:
>
> >> >> >> I tried that but no change I still get the same error :(
>
> >> >> >> On Jan 28, 11:35 pm, Jeremy Burns | Class Outfit
> >> >> >> <jeremybu...@classoutfit.com> wrote:
> >> >> >>> Try replacing $html-> with:
>
> >> >> >>> echo $this->Html->...
>
> >> >> >>> Jeremy Burns
> >> >> >>> Class Outfit
>
> >> >> >>> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> >> >> >>> On 29 Jan 2011, at 07:29, newguy wrote:
>
> >> >> >>>> here is the code(knownusers.ctp) where I have used the helpers:
>
> >> >> >>>> <table>
> >> >> >>>> <?php
> >> >> >>>> echo $html->tableHeaders(array_keys($knownusers[0]['User']));
> >> >> >>>> foreach ($knownusers as $thisuser)
> >> >> >>>> {
> >> >> >>>>    echo $html->tableCells($thisuser['User']);
> >> >> >>>> }
>
> >> >> >>>> ?>
> >> >> >>>> </table>
>
> >> >> >>>> and this is the error which I get when I access
> >> >> >>>>http://localhost:8888/cake_1.2.5/users/knownusersfrombrowser:
>
> >> >> >>>> Missing Helper File
> >> >> >>>> Error: The helper file app/views/helpers/h_t_m_l.php can not be
> >> >> >>>> found
> >> >> >>>> or does not exist.
>
> >> >> >>>> Error: Create the class below in file:
> >> >> >>>> app/views/helpers/h_t_m_l.php
>
> >> >> >>>> <?php
> >> >> >>>> class HTMLHelper extends AppHelper {
>
> >> >> >>>> }
> >> >> >>>> ?>
> >> >> >>>> Notice: If you want to customize this error message, create
> >> >> >>>> app/views/
> >> >> >>>> errors/missing_helper_file.ctp
>
> >> >> >>>> Thanks
> >> >> >>>> On Jan 28, 11:16 pm, Jeremy Burns | Class Outfit
> >> >> >>>> <jeremybu...@classoutfit.com> wrote:
> >> >> >>>>> Can you show the line of code that is being called and returning
> >> >> >>>>> this
> >> >> >>>>> error?
>
> >> >> >>>>> Jeremy Burns
> >> >> >>>>> Class Outfit
>
> >> >> >>>>> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> >> >> >>>>> On 29 Jan 2011, at 07:09, newguy wrote:
>
> >> >> >>>>>> Hi guys
> >> >> >>>>>> am new to cakephp and Iam developing a simple user registration
> >> >> >>>>>> and
> >> >> >>>>>> login system for my site, I used two helpers tableHeaders and
> >> >> >>>>>> tableCells in my view code but I get the following errors:
>
> >> >> >>>>>> Error: The helper file app/views/helpers/h_t_m_l.php can not be
> >> >> >>>>>> found
> >> >> >>>>>> or does not exist.
>
> >> >> >>>>>> Error: Create the class below in file:
> >> >> >>>>>> app/views/helpers/h_t_m_l.php
>
> >> >> >>>>>> I realized that in folder helpers I have a file named empty and
> >> >> >>>>>> there
> >> >> >>>>>> is no code there, so if I understand correctly in order to use
> >> >> >>>>>> helpers
> >> >> >>>>>> I need to put the code in this helper file???? and should it be
> >> >> >>>>>> in
> >> >> >>>>>> the
> >> >> >>>>>> form of functions, in what way should code be written in this
> >> >> >>>>>> file
> >> >> >>>>>> under folder helper and what should be the name of this file.
> >> >> >>>>>> If someone can please give a small example I would be grateful.
>
> >> >> >>>>>> Thanks
>
> >> >> >>>>>> --
> >> >> >>>>>> Our newest site for the community: CakePHP Video
> >> >> >>>>>> Tutorialshttp://tv.cakephp.org
> >> >> >>>>>> Check out the new CakePHP Questions
> >> >> >>>>>> sitehttp://ask.cakephp.organdhelp
> >> >> >>>>>> others with their CakePHP related questions.
>
> >> >> >>>>>> To unsubscribe from this group, send email to
> >> >> >>>>>> cake-php+unsubscribe@googlegroups.com For more options, visit
> >> >> >>>>>> this
> >> >> >>>>>> group athttp://groups.google.com/group/cake-php
>
> >> >> >>>> --
> >> >> >>>> Our newest site for the community: CakePHP Video
> >> >> >>>> Tutorialshttp://tv.cakephp.org
> >> >> >>>> Check out the new CakePHP Questions
> >> >> >>>> sitehttp://ask.cakephp.organdhelp
> >> >> >>>> others with their CakePHP related questions.
>
> >> >> >>>> To unsubscribe from this group, send email to
> >> >> >>>> cake-php+unsubscribe@googlegroups.com For more options, visit this
> >> >> >>>> group
> >> >> >>>> athttp://groups.google.com/group/cake-php
>
> >> >> >> --
> >> >> >> Our newest site for the community: CakePHP Video Tutorials
> >> >> >>http://tv.cakephp.org
> >> >> >> Check out the new CakePHP Questions
> >> >> >> sitehttp://ask.cakephp.organdhelp
> >> >> >> others with their CakePHP related questions.
>
> >> >> >> To unsubscribe from this group, send email to
> >> >> >> cake-php+unsubscribe@googlegroups.com For more options, visit this
> >> >> >> group
> >> >> >> athttp://groups.google.com/group/cake-php
>
> >> >> > --
> >> >> > Our newest site for the community: CakePHP Video Tutorials
> >> >> >http://tv.cakephp.org
> >> >> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> >> >> > others with their CakePHP related questions.
>
> >> >> > 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
>
> >> >> --
> >> >>  - S
>
> >> >> +44 (0)7908 069 219
>
> >> > --
> >> > Our newest site for the community: CakePHP Video Tutorials
> >> >http://tv.cakephp.org
> >> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> >> > others with their CakePHP related questions.
>
> >> > 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
>
> >> --
> >>  - S
>
> >> +44 (0)7908 069 219
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > 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
>
> --
>  - S
>
> +44 (0)7908 069 219

--
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: