including javascript file in default layout

2007-11-29 Thread sMAshdot

Hello!

I have added the Javascript Helper to the $helpers array in my
controller,
and have a file called functions.js in the app/webroot/js/ directory.
The server (apache2) has it's document root pointing at app/webroot/
(production mode).

now

?php echo $javascript-link('functions.js') ? in the default.thtml
layout renders
script type=text/javascript src=/js/functions.js

but firefox's error console talks about a syntax error in the file and
shows me what it thinks to be my functions.js ... an html document :-(

I wonder if it is a problem with cakephp routes, or the webserver
which goofs up the request for the file. Maybe, am I simply doing
something wrong?

--~--~-~--~~~---~--~~
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: Cake 1.2 isUnique validation

2007-11-29 Thread sMAshdot

On 29 Nov., 13:40, RichardAtHome [EMAIL PROTECTED] wrote:

 As a side note, I suspect isUnique might not meant to be referenced in
 a rule and is meant to be referenced in the controller. If this is
 true can someone point me towards some examples of how / where it
 should be used?

I'm quite new to CakePHP as well, but I check for uniqueness after
validating
the data.

This example comes from the IBM CakePHP tutorials
http://www.ibm.com/developerworks/views/opensource/libraryview.jsp?search_by=cook+web+sites+CakePHP

if ( $this-User-validates($this-data) )
{
  if ( $this-User-findByname($this-data['User']['name']) )
  {
$this-User-invalidate('name');
$this-set('name_error', 'User already exists.');
  }
}

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---