Yiiframework.co.il Code is now open sourced!

I used the extra db file because the schema.sql was throwing errors.

I can see English and sometimes Hebrew …

I am having trouble with urls.

I installed osX: 127.0.0.1/~user/yiiframework-co-il-cms/

I changed the settings in the config files but short URLs don’t work. :(

Thanks for your post, I was also having problems with custom pages.

I made a small change to your solution though to allow urls with dashes like the ‘about-us’ page.

Use this line instead:


$urlrules = array_merge( $urlrules, array(  "<alias:[0-9a-zA-Z_\-]+>/*"=>'site/custompages/index') );

Note:

Anyone still struggling with the custom pages, please ensure that you edit one of the pages and then submit it (you don’t need to make a change).

This will delete the existing url cache and your pages should be viewable.

I find that with language sub-domains set to false, I cannot view the forum or blog posts (Sorry, But the page you were looking for was not found).

It’s probably due to the rules in CustomUrlManager.php similar to the above post.

Has anyone figured out how to get them working properly?

OK fixed it myself by simply mirroring the rules used for sub-domains but removing the sub-domain part.

This should make everything work:


else

	{

		$this->rules = array(

				

			//-----------------------ADMIN--------------

			"<lang:({$active_lang})>/admin" => 'admin/index/index',

			"<lang:({$active_lang})>/admin/<_c:([a-zA-z0-9-]+)>" => 'admin/<_c>/index',

		        "<lang:({$active_lang})>/admin/<_c:([a-zA-z0-9-]+)>/<_a:([a-zA-z0-9-]+)>" => 'admin/<_c>/<_a>',

		        "<lang:({$active_lang})>/admin/<_c:([a-zA-z0-9-]+)>/<_a:([a-zA-z0-9-]+)>//*" => 'admin/<_c>/<_a>/',

			//-----------------------ADMIN--------------

				

			"<lang:({$active_lang})>/" => 'site/index/index',

			"<lang:({$active_lang})>/<_c:([a-zA-z0-9-]+)>" => 'site/<_c>/index',

		        "<lang:({$active_lang})>/<_c:([a-zA-z0-9-]+)>/<_a:([a-zA-z0-9-]+)>" => 'site/<_c>/<_a>',

		        "<lang:({$active_lang})>/<_c:([a-zA-z0-9-]+)>/<_a:([a-zA-z0-9-]+)>//*" => 'site/<_c>/<_a>/',

					

			// Site Map

			"http://{$domain}/sitemap" => array('site/sitemap/index', 'urlSuffix'=>'.xml', 'caseSensitive'=>false),

					

			// Tutorials

			"http://{$domain}/tutorials/category/<alias:(.*)>" => array('site/tutorials/viewcategory'),

			"http://{$domain}/tutorials/view/<alias:(.*)>" => array('site/tutorials/viewtutorial'),

					

			// Blogs

			"http://{$domain}/blog/category/<alias:(.*)>" => array('site/blog/viewcategory'),

			"http://{$domain}/blog/view/<alias:(.*)>" => array('site/blog/viewpost'),

					

			// Extensions

			"http://{$domain}/extensions/category/<alias:(.*)>" => array('site/extensions/viewcategory'),

			"http://{$domain}/extensions/view/<alias:(.*)>" => array('site/extensions/viewpost'),

			"http://{$domain}/extensions/download/<fileid:(\d+)>-<alias:(.*)>" => array('site/extensions/download'),

					

			// User profile

			"http://{$domain}/user/<uid:(\d+)>-<alias:(.*)>" => array('site/users/viewprofile'),

					

			// Forum Topics

			"http://{$domain}/forum/topic/<topicid:(\d+)>-<alias:(.*?)>/*" => array('site/forum/viewtopic'),

					

					

	            

		);

	}

		

	$urlrules = array_merge( $_more, $this->rules );

	$urlrules = array_merge( $urlrules, array(  "<alias:[0-9a-zA-Z_\-]+>/*"=>'site/custompages/index') );

	Yii::app()->cache->set('customurlrules', $urlrules);

Again, after editing this file, edit and save one of the custom pages in the admin section to refresh the custom url cache.

Can you use this on local host ?

If yes, how?

I didn’t manage to get this working on localhost. Had problems with the captcha.

It’s easy to setup as a virtual host though, just follow the instructions here:

http://sawmac.com/xampp/virtualhosts/

ugh!!!!

ok, created a virtual host:

http://yiiframework.local/

then go to change language:

http://yiiframework.local/en

error:

The requested URL /en was not found on this server.

here’s my index file:


<?php


// change the following paths if necessary

$yii=dirname(__FILE__).'/framework/yiilite.php';

$config=dirname(__FILE__).'/protected/config/';

// Define root directory

defined('ROOT_PATH') or define('ROOT_PATH', dirname(__FILE__) . '/');


// remove the following lines when in production mode

defined('YII_DEBUG') or define('YII_DEBUG', false);


if( YII_DEBUG === true )

{

	ini_set('display_errors', true);

	error_reporting(E_ALL);

	

	// By default we use testing.com for the currently active domain

#	define('CURRENT_ACTIVE_DOMAIN', 'http://127.0.0.1/~lime/yiiframework-co-il-cms/');

	define('CURRENT_ACTIVE_DOMAIN', 'http://yiiframework.local/');

}

else

{

	//ini_set('display_errors', false);

	//error_reporting(0);

	ini_set('display_errors', true);

	error_reporting(E_ALL);

	

	// On production it will be the yiiframework.co.il domain name

#	define('CURRENT_ACTIVE_DOMAIN', 'http://127.0.0.1/~lime/yiiframework-co-il-cms/');

	define('CURRENT_ACTIVE_DOMAIN', 'http://yiiframework.local/');

}


$configFile = YII_DEBUG ? 'dev.php' : 'production.php';


require_once($yii);

Yii::createWebApplication($config . $configFile)->run();

That probably caused due to wrong URL rules. The index looks fine.

This is kinda hard for me to maintain so if anyone is interested i can put this up on github and provide access for others to contribute.

Where can I find the section that does the rules?

I really like the demo :(

protected/components/CustomUrlManager.php

Ok, getting closer!

CustomUrlManager is not giving a result for $urlrules.

The check is just skipping the If and returning an array for that string.

Using print_r ( $urlrules ) ;

So, yiiframework.local/en/… or even yiifreamework.local/documentation/guide/… is broken.

I checked for mod_rewrite and all the stuff too

Solved!!!

I was right and wrong!

Urls were not working because htaccess wasn’t working!

AllowOverride was set to None and not All in httpd.conf

Glad you got it working.

So am i!

I had to use a stock yii htaccess to get in since your htaccess was giving me forbidden errors

I can see the site and navigate but:

Can’t get to admin :: CException error - not allowed to enter this section

Login (menu) :: using the rmail from the db, and admin as password, capthcha >> error is CSRF token could jot be verified (( I’m not connected to the net ))

Hi Vince,

I understand that you have commitments and can’t maintain this yourself at the moment. I’m just glad that you were prepared to share your code with us.

It’s a great idea to let others contribute. I’m sure there will be a huge interest in this project since it’s what a lot of people have been asking for in the forums for years and you’ve done a great job.

Thanks again!

@sapporoguy see if this helps for the second problem:

http://www.yiiframework.com/forum/index.php/topic/17837-yiiframeworkcoil-code-is-now-open-sourced/page__view__findpost__p__99346

For the first one try using the User:hashPassword(‘yourpassword’, ‘emailaddress’);

to get a new password and then just update the user record and paste the new password. Make sure the email you used in the hashPassword method matches the user email address in the db.

@outrage No problem. I’ll work on adding it to github

still learning iii: where should I do: “User:hashPassword(‘yourpassword’, ‘emailaddress’);”

Here is the htaccess that I used to get a working site:


Options +FollowSymLinks

IndexIgnore */*

RewriteEngine on


# if a directory or a file exists, use it directly

# RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d


# otherwise forward it to index.php

 RewriteRule . index.php



anywhere, just put it somewhere in the views so you’ll get a pass hash that you’ll put in the db for the user you are trying to access with. This is just a hack so you’ll be able to login.

OK, I added


<?php echo User:hashPassword('yourpassword', 'emailaddress'); ?>



to the index view.

I tried with the above and with real information but still got:

Parse error: parse error, expecting ','' or‘;’’ in /Users/lime/Sites/yiiframework/protected/modules/site/views/index/index.php on line 1 Call Stack: 0.0004 641248 1. {main}()

And a bunch more errors :(

dude, really sorry I keep bugging you about this!

If you’re really in LA, I’ll buy you a beer when I go back in June :D

We have a working demo here in english: http://goarc.org/yii

Most of the pages do not function properly, did I miss something?

Nvm, the issue was with .htaccess d’oh!