Yii Framework Forum: Extensions and folder structure - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Extensions and folder structure Rate Topic: -----

#1 User is offline   Fred Anthony 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 26-April 12

Posted 26 April 2012 - 12:34 PM

I want to start off by stating that I am totally new to Yii, I've used several other "frameworks" in the past and I've been reading a lot on Yii lately. I'm thinking of using Yii for my next project but after going through some of the documentation I'm still a little fuzzy on a few things.

I'm starting off with integrating Smarty, I've used it in the past and I have a lot of code written that saves me time when generating forms etc. I've looked through what I could find on the net and I see 3 different ways of doing this. Now I'm not referring to the code really, that I understand, but where is the proper place to add these extensions?

Do I create a ViewRenderer under framework/web/renderers? Do I place it in my application protected folder? My concern is when it comes time to upgrade Yii I don't want to be comparing files in the framework folder. In Kohana
(love hate) I would have created a module and placed all files there outside of the "framework" folder. Also, when the documentation refers to the application folder, is this the folder for my project I created? Thanks again.

Fred.
0

#2 User is offline   bluyell 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 201
  • Joined: 28-October 11

Posted 26 April 2012 - 01:03 PM

at first place, you -must- understand Yii more deeply (not so much, but sufficient), try out demos and the fundamentals of using models, views, controllers and its actions, forms, etc. Is very basic, but powerfull.
0

#3 User is offline   Fred Anthony 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 26-April 12

Posted 26 April 2012 - 01:11 PM

bluyell,

Thanks for the response. I have familiarized myself with much of the documentation and code base via the API documentation. I was asking more of where I place extension for such things as a ViewRenderer so that my code base is upgrade safe and as efficient as possible.
0

#4 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 26 April 2012 - 01:47 PM

It depends. :)

I usually put custom components in 'components', but if I create an extension (which is basically a collection of files instead), I put them in 'extensions'.
If it is a widget, it usually goes in 'widgets' - unless, of course, that widget is an extension..
In which case it would go in 'extensions'.

There is not really a lot of rules here.

So, how do you get started, then?

I started by downloading and looking at various extension, so I suggest that you do the same.
"Less noise - more signal"
0

#5 User is offline   Fred Anthony 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 26-April 12

Posted 26 April 2012 - 02:25 PM

jacmoe,

I think I'll go with with sticking the customer renderer in my "application" folder, protected/extensions/renderers. Thanks for the tips.
0

#6 User is offline   bluyell 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 201
  • Joined: 28-October 11

Posted 26 April 2012 - 03:00 PM

View PostFred Anthony, on 26 April 2012 - 01:11 PM, said:

bluyell,

Thanks for the response. I have familiarized myself with much of the documentation and code base via the API documentation. I was asking more of where I place extension for such things as a ViewRenderer so that my code base is upgrade safe and as efficient as possible.



under protected/components folder, and, if need more organization on it ( components/mycomponent/mysubfolder1/etc ) then you need to tell Yii that this folders will be loaded too, this is done in protected/config/main.php:


(file: protected/config/main.php)

'import'=>array(
'application.models.*',
'application.models.design.*',
'application.components.*', // this will load and import all files under components folder,
'application.components.mycomponentfolder.*', // and this, will load an example sub folder, if you wish...
),





0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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