Hi Federico,

> Hi all, I'm working in a helper that has to output lot of JS code. The thing
> is that I really dislike coding JS as string (ie "alert('whatever')")
> becouse I'm loosing all the code completition that modern IDE's do for me.
> So I'm actually doing something like this:
>
> (inside a helper class)
>
> function getSomeHtml(){
>         $output = ob_get_clean();
>         ob_start();
>         ?>
>
> HTML and JS here
>
>         <?php
>         $returnValue = ob_get_clean();
>         ob_start();
>         echo $output;
>         return $returnValue;
>
> }
>
> But I noticed that most helpers (even Cake core ones) use the other way of
> coding (creating JS as a PHP string). So I guess what I'm doing isn't good
> at all. Any sugestions?

I usually use the string approach. Another idea is to put the HTML and
JS code into a separate file which is then loaded from your helper.
Maybe that's something you could use?

--
Daniel Hofstetter
http://cakebaker.42dh.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