Re: cakex html inside controller

2007-06-19 Thread jitka (poLK)

> i want to have only ONE code logic for addUser, thats why i use
innerHTML to add the html code within the addUser-div only if its
necessary.

Do you understand what does this code?
link('Add new item', '/phases/formAdd/',
array('update' => 'add')); ?>
It renders link, which will cause that rendered content will be not
dropped, but it will be grabbed and with response->assign() assigned
to innerHTML property of element with 'add' id. So only markup you
should add (besides of this link) is 

There are other possible ways, for example create CakeX plugin, which
will utilize afterRender() callback, get content of output buffer and
'append' it somewhere (instead of 'assign')...

You're in CakePHP community now, so I think that CakeX does it's job
well - it brings new people here ;) BUT: it is better to use another
JS library with CakePHP (I prefer jQuery). I understand your position
- you're familiar with xajax already and you want to utilize this
knowledge as much as possible... But you should know that xajax
philosophy, request flow etc is in conflict with CakePHP and CakeX
code have to deal with those incompatibilities internally...

With some exceptions, I am using CakeX _only_ for simple things, where
I want to use beauty of xajaxResponse methods and xajax plugins - and
I propose to you exactly same thing.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: cakex html inside controller

2007-06-19 Thread pete

thanks for all your hints.
as i really like xajax i have already installed Cakex.

the reason why i create this html-code inside the controller is, that
i have a Navigation with "Add User" which is available on each page.
As soon as i click on it, i render the html code inside 

- i want to have only ONE code logic for addUser, thats why i use
innerHTML to add the html code within the addUser-div only if its
necessary.

 Should be available for each view:
  ...

 - i dont wanna add this div with the form logic inside each view.


- Do you consider using the requestAction and creating a addUser.thml
inside /views/elements?
- Or is it better to create "addUser" plugin (like the cakex examples)

thanks

pete



On Jun 19, 1:29 am, "jitka (poLK)" <[EMAIL PROTECTED]> wrote:
> Well, not everything what is possible is automatically right.
>
> My propose is NOT keep any html content in controller - it is work for
> view. You're imho looking for
>
> link('Add new item', '/phases/formAdd/',
> array('update' => 'add')); ?>
>
> BTW: xajax is a great library, but it is aiming to people without php
> framework, as it does dispatching, basic sanitize etc. One of reasons
> why was CakeX written and published is: take some people from xajax
> community to CakePHP world ;)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: cakex html inside controller

2007-06-19 Thread jitka (poLK)

Well, not everything what is possible is automatically right.

My propose is NOT keep any html content in controller - it is work for
view. You're imho looking for

link('Add new item', '/phases/formAdd/',
array('update' => 'add')); ?>

BTW: xajax is a great library, but it is aiming to people without php
framework, as it does dispatching, basic sanitize etc. One of reasons
why was CakeX written and published is: take some people from xajax
community to CakePHP world ;)



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: cakex html inside controller

2007-06-18 Thread francky06l

you can do this using ajax and some javascript (have a look to the CJS
from Rosssoft)

On Jun 19, 6:13 am, pete <[EMAIL PROTECTED]> wrote:
> hm..you are right, the thing is i want to have the "add-form" on the
> same page as where i show the data.
> is there a way to assign('add') the view.html code?
>
> something like
>   $objResponse->assign('add', 'innerHTML',$??view.thtml??);
>
> thanks pete
>
> On Jun 18, 8:40 pm, Geoff Ford <[EMAIL PROTECTED]> wrote:
>
> > I wouldn't be doing it
>
> >  - Breaks MVC putting html in the controller.
> >  - Mixing presentation with business logic is never good
> >  - Harder to update
> >  - DOes not allow for multiple presentation types
>
> > On Jun 19, 12:52 pm, pete <[EMAIL PROTECTED]> wrote:
>
> > > hi,
> > > im using cakex (xajax) for my project. i'm just curious if its a good
> > > idea to put html code inside the controller
> > > for example i have a ajax "addForm".
> > > Do you think this is a good idea to do it or is it better to have all
> > > html code inside a view.thtml ?
>
> > > thanks
>
> > > pete
>
> > > VIEW
> > > link('Add new item', '/phases/formAdd/'); ?>
> > > 
>
> > > CONTROLLER
>
> > >  function formAdd(){
> > >$this->autoRender = false;
> > >$objResponse =& $this->Cakex->response;
> > >$objResponse = new xajaxResponse();
>
> > >$html = '
> > > 
> > > 
> > > 
> > > Last Name*
> > >  > > id="lastname" name="lastname"
> > > size="25">fff
> > > 
>
> > > 
> > >  > > id="submitButton" onClick=
> > > \'...\'>Continue
> > > 
> > > 
> > >'
> > >   $objResponse->assign('add', 'innerHTML',$html);
>
> > > }
> > > }


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: cakex html inside controller

2007-06-18 Thread pete

hm..you are right, the thing is i want to have the "add-form" on the
same page as where i show the data.
is there a way to assign('add') the view.html code?

something like
  $objResponse->assign('add', 'innerHTML',$??view.thtml??);

thanks pete


On Jun 18, 8:40 pm, Geoff Ford <[EMAIL PROTECTED]> wrote:
> I wouldn't be doing it
>
>  - Breaks MVC putting html in the controller.
>  - Mixing presentation with business logic is never good
>  - Harder to update
>  - DOes not allow for multiple presentation types
>
> On Jun 19, 12:52 pm, pete <[EMAIL PROTECTED]> wrote:
>
> > hi,
> > im using cakex (xajax) for my project. i'm just curious if its a good
> > idea to put html code inside the controller
> > for example i have a ajax "addForm".
> > Do you think this is a good idea to do it or is it better to have all
> > html code inside a view.thtml ?
>
> > thanks
>
> > pete
>
> > VIEW
> > link('Add new item', '/phases/formAdd/'); ?>
> > 
>
> > CONTROLLER
>
> >  function formAdd(){
> >$this->autoRender = false;
> >$objResponse =& $this->Cakex->response;
> >$objResponse = new xajaxResponse();
>
> >$html = '
> > 
> > 
> > 
> > Last Name*
> >  > id="lastname" name="lastname"
> > size="25">fff
> > 
>
> > 
> >  > id="submitButton" onClick=
> > \'...\'>Continue
> > 
> > 
> >'
> >   $objResponse->assign('add', 'innerHTML',$html);
>
> > }
> > }


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: cakex html inside controller

2007-06-18 Thread Geoff Ford

I wouldn't be doing it

 - Breaks MVC putting html in the controller.
 - Mixing presentation with business logic is never good
 - Harder to update
 - DOes not allow for multiple presentation types

On Jun 19, 12:52 pm, pete <[EMAIL PROTECTED]> wrote:
> hi,
> im using cakex (xajax) for my project. i'm just curious if its a good
> idea to put html code inside the controller
> for example i have a ajax "addForm".
> Do you think this is a good idea to do it or is it better to have all
> html code inside a view.thtml ?
>
> thanks
>
> pete
>
> VIEW
> link('Add new item', '/phases/formAdd/'); ?>
> 
>
> CONTROLLER
>
>  function formAdd(){
>$this->autoRender = false;
>$objResponse =& $this->Cakex->response;
>$objResponse = new xajaxResponse();
>
>$html = '
> 
> 
> 
> Last Name*
>  id="lastname" name="lastname"
> size="25">fff
> 
>
> 
>  id="submitButton" onClick=
> \'...\'>Continue
> 
> 
>'
>   $objResponse->assign('add', 'innerHTML',$html);
>
> }
> }


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---