Where to not-quite-begin?

I am a coder on a site that is going through a significant overhaul, switching to a Yii framework. Unfortunately, I’ve never used Yii before, and really have no idea what I’m doing. The site owner has already gone through the process of setting up Yii, and at least a few functions already work with that - which, as you may notice, makes most of the “getting started” tutorials pretty irrelevant. And what has been set up doesn’t appear to be set up in the way one would expect, leading to further confusion. So I’ve just kind of been plucked from my comfortable world of working code and thrust into a completely new situation, where I’m expected to already know what I’m doing if the site has progressed this far.

At this point, I’m just trying to get the chat page to exist. The page at chat/view/1 is supposed to go to chat room 1, and right now, it does nothing. If I could even just get it to output “test 1” (the ‘1’ reflecting the ‘1’ in the URL) then I could easily hammer our existing code into place, but I can’t do anything with a page that’s not there to begin with.

From what I can tell, I may or may not be supposed to run this “yiic” command-line tool. I’d really, really rather not - partially because this seems set up oddly, partially because I don’t want to accidentally break anything with some black-box automated tool, and partially because that’s not going to teach me anything about how this framework functions. If anyone could tell me roughly what goes where - even enough for me to find and examine the existing, working code - I would be most appreciative.

Create "controllers/ChatController.php" and implement as follows:




<?php


class ChatController extends CController

{

  public function actionView()

  {

    $this->renderText('<p>hello, world</p>');

  }

}



The Guide is a great place to start, and I highly recommend downloading the class reference CHM for reference.

Good luck :slight_smile:

Hello,

at this point you shouldn’t need yiic. Also if you have version 1.1.2 you could try to use gii.

Anyway for your problem I suggest you to check out if url manager is being used but before read this pages:

http://www.yiiframework.com/doc/guide/basics.mvc

http://www.yiiframework.com/doc/guide/basics.application

http://www.yiiframework.com/doc/guide/topics.url

If you find (from the app. configuration in protected/config/main.php) that url manager is used, also check your .htaccess file if you are using apache.

and about gii:

http://www.yiiframework.com/doc/guide/topics.gii

The good thing for you is that Yii is well documented ;)

bye,

Giovanni.

There we go! I didn’t really mess with the Guide, since it claimed a difficulty level of 3. I should have guessed the top was the best place to start ;) Now I’ve got the beginning of my new chat system (rapidly evolving by the minute), and I get to yell at my boss - chat/view/1 will never be a valid page :P Thanks for the help!