I've addedd:
4 var $actual_year;
5
6 public function __construct()
7 {
8 $this->actual_year = date('Y');
9 }
and I get:
Warning: Unexpected character in input: ' ' (ASCII=29) state=1 in /
Applications/MAMP/htdocs/cakephp/app/models/album.php on line 9
Fatal error: Call to a member function trigger() on a non-object in /
Applications/MAMP/htdocs/cakephp/cake/libs/model/model.php on line
2066
On 22 Lug, 16:57, ohcibi <[email protected]> wrote:
> You are not allowed to use functions in class variable definitions,
> you could do this in Post::_construct(). This is a php restriction
>
> On 22 Jul., 16:45, "Mariano C." <[email protected]> wrote:
>
>
>
> > <?php
> > class Post extends AppModel
> > {
> > var $name = 'Post';
> > var $hasAndBelongsToMany = 'Tag';
>
> > var $actual_year = date('Y');
>
> > $validate = array
> > (
> > 'year' => array
> > (
> > 'required' => true,
> > 'rule' => array('range', 1899, $actual_year),
> > 'message' => 'Insert a number between 1899 and '.
> > $actual_year
> > )
> > );}
>
> > ?>
>
> > But I get a stupid error on line 7: Parse error: syntax error,
> > unexpected '(', expecting ',' or ';' in /Applications/MAMP/htdocs/
> > cakephp/app/models/album.php on line 7
>
> > Why?
> > Parse error: syntax error, unexpected '(', expecting ',' or ';' in /
> > Applications/MAMP/htdocs/cakephp/app/models/album.php on line 7
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
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