Re: JavascriptHelper bug?

2009-05-21 Thread brian

On Thu, May 21, 2009 at 4:38 AM, Miki  wrote:
>
>> I've never used blockEnd() and don't quite understand its purpose, but
>> codeBlock should take the javascript (as a string) for the first
>> param. It will wrap the code with start/stop tags.
>
> Thanks brian.
>
> If you pass the script in the first param it works as you say, but if
> the script is null the helper should take the script between the calls
> to codeBlock() and blockEnd and do the same thing (if i have
> understood the function). The bug is there.

Yes, I think I see what you mean. I hadn't noticed that. Sorry, I
don't think I can help.

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



Re: JavascriptHelper bug?

2009-05-21 Thread Miki

> I've never used blockEnd() and don't quite understand its purpose, but
> codeBlock should take the javascript (as a string) for the first
> param. It will wrap the code with start/stop tags.

Thanks brian.

If you pass the script in the first param it works as you say, but if
the script is null the helper should take the script between the calls
to codeBlock() and blockEnd and do the same thing (if i have
understood the function). The bug is there.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Re: JavascriptHelper bug?

2009-05-20 Thread brian

I've never used blockEnd() and don't quite understand its purpose, but
codeBlock should take the javascript (as a string) for the first
param. It will wrap the code with start/stop tags.

On Wed, May 20, 2009 at 6:53 AM, Miki  wrote:
>
> Hi all,
>
> I'm a not very experimented user. I'm trying to use jQuery in Cake
> (based on 
> http://bakery.cakephp.org/articles/view/serving-up-actions-as-ajax-with-jquery-in-a-few-simple-steps).
>
> When I tried to use the codeBlock and endBlock functions I have
> unexpected results.
>
> My code in the view:
>
> echo $javascript->link('jquery-1.3.1.min.js',false);
> echo $javascript->link('jquery.form.js',false);
> echo $javascript->codeBlock(null, array('inline' => false));
> ?>
> $(document).ready(function() {
>    var options = {
>        target:'#elementsList'   // target element(s) to be updated
> with server response
>    };
>
>    // bind form using 'ajaxForm'
>    $('#newElementForm').ajaxForm(options);
> });
>  echo $javascript->blockEnd();
> ?>
>
> I have shown that the blockEnd always print the end script tag to the
> html (inline is not running well).
>
> I look the Cake code and change it (first time) adding this in the
> blockEnd. I think that it fix the bug (if it is a bug):
>
> //existing code
> if (isset($options['inline']) && !$options['inline']) {
>                        $view =& ClassRegistry::getObject('view');
> //new code
>                        if ($safe) {
>                                $script  = "\n" . '//' . "\n";
>                        }
> //existing code
>                        
> $view->addScript(sprintf($this->tags['javascriptblock'], $script));
> //new code
>                        return null;
> }
>
> I hope it helps.
>
> Miki
> >
>

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



JavascriptHelper bug?

2009-05-20 Thread Miki

Hi all,

I'm a not very experimented user. I'm trying to use jQuery in Cake
(based on 
http://bakery.cakephp.org/articles/view/serving-up-actions-as-ajax-with-jquery-in-a-few-simple-steps).

When I tried to use the codeBlock and endBlock functions I have
unexpected results.

My code in the view:

echo $javascript->link('jquery-1.3.1.min.js',false);
echo $javascript->link('jquery.form.js',false);
echo $javascript->codeBlock(null, array('inline' => false));
?>
$(document).ready(function() {
var options = {
target:'#elementsList'   // target element(s) to be updated
with server response
};

// bind form using 'ajaxForm'
$('#newElementForm').ajaxForm(options);
});
blockEnd();
?>

I have shown that the blockEnd always print the end script tag to the
html (inline is not running well).

I look the Cake code and change it (first time) adding this in the
blockEnd. I think that it fix the bug (if it is a bug):

//existing code
if (isset($options['inline']) && !$options['inline']) {
$view =& ClassRegistry::getObject('view');
//new code
if ($safe) {
$script  = "\n" . '//' . "\n";
}
//existing code

$view->addScript(sprintf($this->tags['javascriptblock'], $script));
//new code
return null;
}

I hope it helps.

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