Yii Framework Forum: Yii skeleton app - Yii Framework Forum

Jump to content

  • (9 Pages)
  • +
  • « First
  • 7
  • 8
  • 9
  • You cannot start a new topic
  • This topic is locked

Yii skeleton app Rate Topic: -----

#161 User is offline   Joe Storm 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 133
  • Joined: 17-April 10

Posted 01 July 2010 - 01:07 PM

can someone please post what exactly need to be changed in the files to work with 1.1.2?
0

#162 User is offline   Joe Storm 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 133
  • Joined: 17-April 10

Posted 03 July 2010 - 07:22 AM

Alright, I will update this as I try to make it run without exception. Might break a few things but thought it can be helpful for newbies like me looking for a better start than yiiblog.

download http://subversion.apache.org/ fire up the cmd
paste the svn command line found in previous post.. you should be downloading the codes.


CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'post.created' in 'order clause'

Change all `post`.`fieldname` to `t`.`fieldname` on Controller and Views

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1364 Field 'created' doesn't have a default value


http://www.yiiframew...oc/cookbook/10/
http://www.yiiframew...mestampBehavior
in Model
	public function behaviors(){
		return array(
			'ParseCacheBehavior' => array(
				'class' => 'ParseCacheBehavior',
				'attributes' => array('content'),
			),

			/* Remove this
                        'AutoTimestampBehavior' => array(
			  'class' => 'AutoTimestampBehavior',
			  'class' => 'application.components.behaviors.AutoTimestampBehavior',
			)
                         */
                        
                        //added this codes
         		'CTimestampBehavior' => array(
  			'class' => 'zii.behaviors.CTimestampBehavior',
  			'createAttribute' => 'created',
  			'updateAttribute' => 'modified',
  			'setUpdateOnCreate' => true,
  		)
		);
	}

	


When creating a new post
Missing argument 1 for Post::beforeValidate(), called in D:\Domains\altruism.com.my\wwwroot\framework\base\CModel.php on line 147 and defined

	
//REPLACE
protected function beforeValidate($on) {
   if ($this->isNewRecord)
   $this->user_id = Yii::app()->user->id;
return parent::beforeValidate($on);	
	}  
//WITH
protected function beforeValidate() {
  if ($this->isNewRecord)
  $this->user_id = Yii::app()->user->id;
		return parent::beforeValidate();	
}  


Will add more if i get it to run..
0

#163 User is offline   Joe Storm 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 133
  • Joined: 17-April 10

Posted 03 July 2010 - 02:38 PM

I wished someone who have converted this to 1.1 can help out..as someone new to yii, its taking me long

I get this when I register a new user but can't find anywhere that filled up the about field.

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1364 Field 'about' doesn't have a default value
0

#164 User is offline   scottos 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 01-July 10

Posted 14 July 2010 - 04:16 PM

I was working on cleaning up the errors in the Skeleton app as well. The error that was generated from registering a new user is due to this code in the User model, User.php:

	public function safeAttributes() {
		return array(
			//parent::safeAttributes(),
			'update'=>'about, password, password_repeat',
			'updateAdmin'=>'about, password, password_repeat, group_id',
			'login'=>'username, password, rememberMe',
		);
	}


safeAttributes() was removed in 1.1 and became part of the validation rules as detailed in the Definitive Guide here: Upgrading from 1.0 to 1.1

I added these lines to the validation rules:

array('about, password_repeat','safe', 'on' => 'update, updateAdmin'),

array('username, rememberMe','safe', 'on' => 'login'),


Some of the other fields were already covered by other rules which should make them 'safe' under those scenarios. That is, if I am understanding correctly.

Anyway, user registration now works on the Skeleton app under 1.1.3. I am digging around in it and I'll see what else comes up.
0

#165 User is offline   scottos 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 01-July 10

Posted 14 July 2010 - 04:29 PM

An empty case of safeAttributes is in the Post Model, Post.php

	public function safeAttributes() {
		/**
		* ActiveRecord is extended to know that 'required' attributes are 'safe'.
		* We return a empty array so that it won't think 'created' and 'modified' are 'safe'.
		* It will still know 'title' and 'content' are safe because they are 'required'
		*/
		return array(); 
	}


You may want to remove that as well.
0

#166 User is offline   shani1351 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 27-February 11

Posted 27 February 2011 - 10:54 AM

Hello,
I've uploaded the Yii skeleton app with my modifications to make it work with yii-1.1.6.r2877

you can download it here : websitebuildingsolutions.com/Yii_skeleton.rar

In the tables creation file - the user table creation should be :
CREATE TABLE IF NOT EXISTS `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL,
  `password` char(50) NOT NULL,
  `email` varchar(100) NOT NULL,
  `email_visible` tinyint(1) NOT NULL DEFAULT '0',
  `notify_comments` tinyint(1) NOT NULL DEFAULT '1',
  `notify_messages` tinyint(1) NOT NULL DEFAULT '1',
  `about` text DEFAULT NULL,
  `aboutParsed` text NOT NULL,
  `group_id` int(11) NOT NULL DEFAULT '2',
  `email_confirmed` char(21) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `modified` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `group_id` (`group_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;


the change from the original file - `about` text DEFAULT NULL,

The only error I get now (from what I sew) is in jquery:
elem.attributes is null

but it looks like everything works...

Hope it will help
0

#167 User is offline   jonah 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 733
  • Joined: 27-November 08
  • Location:California (US)

Posted 27 February 2011 - 12:42 PM

Do you mind if I modify the svn with your changes? In fact, I could even add you as an admin

View Postshani1351, on 27 February 2011 - 10:54 AM, said:

Hello,
I've uploaded the Yii skeleton app with my modifications to make it work with yii-1.1.6.r2877

you can download it here : websitebuildingsolutions.com/Yii_skeleton.rar

In the tables creation file - the user table creation should be :
CREATE TABLE IF NOT EXISTS `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL,
  `password` char(50) NOT NULL,
  `email` varchar(100) NOT NULL,
  `email_visible` tinyint(1) NOT NULL DEFAULT '0',
  `notify_comments` tinyint(1) NOT NULL DEFAULT '1',
  `notify_messages` tinyint(1) NOT NULL DEFAULT '1',
  `about` text DEFAULT NULL,
  `aboutParsed` text NOT NULL,
  `group_id` int(11) NOT NULL DEFAULT '2',
  `email_confirmed` char(21) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `modified` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `group_id` (`group_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;


the change from the original file - `about` text DEFAULT NULL,

The only error I get now (from what I sew) is in jquery:
elem.attributes is null

but it looks like everything works...

Hope it will help

http://php-thoughts.cubedwater.com - my bloggings about Yii
0

#168 User is offline   Eight Minus Eight 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 02-February 11

Posted 28 February 2011 - 07:53 AM

First, shani, thanks for the fix.

And much thanks to the guy who put it together in the first place. In learning Yii the first thing I was thinking after making a few test projects was making a new skeleton of my own until I stumpled onto yours. I was working on getting it up and running for the latest version of yii as well, you saved me a bunch o time no doubt.


I found one other error that I fixed as well that I wanted to pass on. If you go to posts section while you are not logged in and try to create a post, you get a "Property "AccessRule.message" is not defined.", meaning basically it can't find the variable that is supposed to be holding the "not logged in" or whatever.

The fix is to take this file:

/protected/components/AccessControlFilter.php


in the AccessRule class at or around line 75, or anywhere where the class properties are defined, add this:


	/**
	 * @var string the error message to be displayed when authorization is denied by this rule.
	 * If not set, a default error message will be displayed.
	 * @since 1.1.1
	 */
	public $message;



seems to fix that issue.


Christopher
0

#169 User is offline   jonah 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 733
  • Joined: 27-November 08
  • Location:California (US)

Posted 28 February 2011 - 11:17 PM

I just put some updates in to get the app working on Yii 1.1.6. It still uses the old yii default template, and the old menu component.. It was just a quick fix
http://php-thoughts.cubedwater.com - my bloggings about Yii
1

#170 User is offline   paulboco 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 27-December 10

Posted 12 March 2011 - 11:19 PM

Thank you so much, jonah.
I've spent the last few months trying to learn a PHP framework. I've always rolled my own. First CodeIgniter, then Kohana and now Yii. I've gotten more accomplished in the last six hours with Yii than I have with CI and KO3 since November 2010.
It seems rudimentary to me that a framework would offer a working skeleton to give the developer a quick start. After all, isn't that is what a framework is for - quick development? And that (speaking for myself) is lacking with the other frameworks I've tried. Thanks for helping me get started.
0

#171 User is offline   paulboco 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 27-December 10

Posted 13 March 2011 - 08:23 PM

Quote

The only error I get now (from what I sew) is in jquery:
elem.attributes is null

In file /protected/modules/textedit/components/TextEditor.php, around lines 64,65 change...

loaddata: {id: $(this).attr('id')},
submitdata: {id: $(this).attr('id')},


to...

loaddata: {id: this.id},
submitdata: {id: this.id},


I'm not sure this is the proper way to do it but it worked for me.
0

#172 User is offline   shani1351 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 27-February 11

Posted 15 May 2011 - 04:55 AM

View Postjonah, on 27 February 2011 - 12:42 PM, said:

Do you mind if I modify the svn with your changes? In fact, I could even add you as an admin





I didn't get a notification about that post... If it's still relevant - sure, you can modify the svn with my changes.


0

#173 User is offline   insun 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 62
  • Joined: 02-August 11

Posted 03 August 2011 - 08:18 PM

cool,but no download available now~~~
0

#174 User is offline   webid 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 14-December 08

Posted 03 August 2011 - 08:35 PM

View Postinsun, on 03 August 2011 - 08:18 PM, said:

cool,but no download available now~~~


Checkout:

Quote

svn checkout http://yii-skeleton-....com/svn/trunk/ yii-skeleton-app-read-only

using one of these: http://en.wikipedia....mparison_matrix
0

#175 User is offline   LeoMoraes 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 17-September 11

Posted 20 September 2011 - 01:52 PM

View Postdhanya_kr, on 20 September 2009 - 08:52 AM, said:

Hi,
I got the app. but when i try the links i am getting the following error.

'Not Found The requested URL /yii/site/contact was not found on this server.'

Can anyone help me to solve this?


Edit the /config/main.php
Update or coment the param urlManager
0

Share this topic:


  • (9 Pages)
  • +
  • « First
  • 7
  • 8
  • 9
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users

  1. Google