Yii Framework Forum: Directory structure - Yii Framework Forum

Jump to content

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

Directory structure

#1 User is offline   rinat.io 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 20-January 11

Posted 07 October 2011 - 04:30 AM

Hello guys. What are you thinking about default yii directory structure. Will it be the same?
0

#2 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,788
  • Joined: 17-January 09
  • Location:Russia

Posted 07 October 2011 - 09:48 AM

You mean one that's generated by yiic webapp? Last time we've discussed it the decision was to provide multiple bootstrap directory structures.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
1

#3 User is offline   rinat.io 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 20-January 11

Posted 09 October 2011 - 05:12 PM

Yes, that's what I'm talking about. I think a lot of developers are using directory structure generated by yiic. Have you decide which options to provide?
0

#4 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,788
  • Joined: 17-January 09
  • Location:Russia

Posted 09 October 2011 - 06:36 PM

Preliminarily it was decided that yiic webapp will be able to generate multiple bootstrap types. At least one of these will be pretty much the same as it is.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#5 User is offline   lubosdz 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 115
  • Joined: 25-July 10
  • Location:Slovakia, Bratislava

Posted 11 October 2011 - 04:51 PM

View Postsamdark, on 09 October 2011 - 06:36 PM, said:

Preliminarily it was decided that yiic webapp will be able to generate multiple bootstrap types. At least one of these will be pretty much the same as it is.


Hi,

I apologize, but it is not quite clear to me, what is meant by "multiple bootstrap types"?
Does that mean that I can choose generated site structure?
Or perhaps what type of webapp shall be generated?

Problem has been discussed also here:
http://www.yiiframew...post__p__101871

_______________________________________________________________________________

Also my question:

Currently the extension "giix" implements advanced features for generating webapp. Would you consider moving such extension into Gii module?

Thanx
Lubos
Yii extension: Captcha Extended

Greatest discoveries in 22nd century will be about the gravitation. | http://www.synet.sk | http://ipdf.sk
0

#6 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,788
  • Joined: 17-January 09
  • Location:Russia

Posted 11 October 2011 - 06:42 PM

multiple bootstrap types = webapp types.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
1

#7 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 665
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 13 October 2011 - 01:21 PM

View Postlubosdz, on 11 October 2011 - 04:51 PM, said:

Currently the extension "giix" implements advanced features for generating webapp.


giix won't generate the application. You still need to run yiic webapp in the console to generate the application.
giix will generate model and crud files for an existing application.
0

#8 User is offline   lubosdz 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 115
  • Joined: 25-July 10
  • Location:Slovakia, Bratislava

Posted 16 October 2011 - 01:59 PM

View Postmentel, on 13 October 2011 - 01:21 PM, said:

giix won't generate the application. You still need to run yiic webapp in the console to generate the application.
giix will generate model and crud files for an existing application.


Right, of course, sorry for typo.

Yet, my previous question remains unanswered - some extensions are better than the ones supplied along with the framework Yii 1.X. For example giix or captcha-extended, that I wrote after the original Yii captcha was broken after 2 days by spammers.

So my original question is - Is there a plan to move some improved extensions into Yii 2.0 core?
I believe that would be quite beneficial for the framework.

Cheers
Lubos
Yii extension: Captcha Extended

Greatest discoveries in 22nd century will be about the gravitation. | http://www.synet.sk | http://ipdf.sk
0

#9 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,788
  • Joined: 17-January 09
  • Location:Russia

Posted 17 October 2011 - 01:47 PM

We have to maintain backwards compatibility but since we'll push Yii2 alpha to GitHub you'll have a chance to get your changes into the core before first stable release.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
1

#10 User is offline   Seal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 126
  • Joined: 02-February 10

Posted 02 January 2012 - 11:21 AM

Hi,

It is good that you will be moving yii2 to github. I also like the idea of generating multi bootstrap...

With gii, we can extend/customise templates for model etc.


Will you be supporting the ability to extend of customise what is generated for the types of webapp and the directory structure that can be generated?
Sylvester La-Tunje

Posted Image
0

#11 User is offline   jacmoe 

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

Posted 02 January 2012 - 01:20 PM

I guess that what you mean by 'multiple' bootstrap types is 'pluggable' ?

Meaning that it's going to be easier to plug your own custom bootstrap into the yiic webapp generator?

That's one of the missing links in Yii IMO.

I usually copy the cli/views/webapp dir and the webapp command and make that my own.
But I feel dirty when I mess around with the framework itself. :)
"Less noise - more signal"
0

#12 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 665
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 23 January 2012 - 02:45 PM

I haven't looked deeply into this, but it seems that Yii requires that the entire "themes" directory to be under the webroot.
It would be nice if we could separate it and have a "themes/themename/views" anywhere and "themes/themename/{images,js,css}" under the webroot.


EDIT: Totally overlooked CThemeManager::basePath.
0

#13 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 569
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 29 January 2012 - 09:03 AM

@mentel: but everything has still to be web-accessible?!
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#14 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 665
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 29 January 2012 - 03:32 PM

View Postschmunk, on 29 January 2012 - 09:03 AM, said:

@mentel: but everything has still to be web-accessible?!


I'm not sure I understand your question, but I'll try to answer it.

The files in "themes/themename/views" don't have to (and shouldn't) be Web-accesible. They shouldn't be under a public directory (webroot). You can leave this directory under "protected" or anywhere else, outside of your public directory.
The directories "themes/themename/{images,js,css}" contain stylesheet, javascript and image files. Those need to be under a public directory.
0

#15 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 569
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 29 January 2012 - 04:11 PM

View Postmentel, on 29 January 2012 - 03:32 PM, said:

The files in "themes/themename/views" don't have to (and shouldn't) be Web-accesible. They shouldn't be under a public directory (webroot). You can leave this directory under "protected" or anywhere else, outside of your public directory.

What I wondered about is, how does CThemeManager::basePath affects the separation of view files and CSS, JS, images?

Furthermore, CThemeManager::basePath has to be a web-accessible directory - right? The only way to protect your views is a .htaccess file. And I found no CThemeManager::viewPath or something.

I hope this explains my initial question a bit better.
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#16 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 665
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 29 January 2012 - 05:28 PM

schmunk,

There's a CThemeManager::baseUrl that deals with the URL of the Web-acessible components of the theme (images, stylesheets, javascript etc).
Since CThemeManager::baseUrl is independent of (and isn't changed when you change) CThemeManager::basePath, you can achieve the separation of the private and the public files.

Thus, CThemeManager::basePath is equivalent to your "CThemeManager::viewPath".

I advise against using a .htaccess file to avoid access to your private files. Someday it can go wrong. It's better to remove the private files from your public directories.
0

#17 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 569
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 29 January 2012 - 05:52 PM

Thank you very much for your explanations.

I would not have understood the docs in that way, I thought they have to point to the same directory.
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#18 User is offline   mmx 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 64
  • Joined: 20-June 11
  • Location:Virginia Beach, VA USA

Posted 04 February 2012 - 07:31 PM

View Postmentel, on 29 January 2012 - 03:32 PM, said:

I'm not sure I understand your question, but I'll try to answer it.

The files in "themes/themename/views" don't have to (and shouldn't) be Web-accesible. They shouldn't be under a public directory (webroot). You can leave this directory under "protected" or anywhere else, outside of your public directory.
The directories "themes/themename/{images,js,css}" contain stylesheet, javascript and image files. Those need to be under a public directory.


But, if a theme is an installable item in your application, it makes sense to keep all associated files together. Web designers for opensource and commercial applications usally provide theme packages based on a standard directory structure partially controlled by application conventions. Some .htaccess protection of the theme directory and including an empty index.htm in the other directories (css/, images/, js/) should suffice for most applications. Unless you know something I don't know which is certainly possible.

I use a modified implementation of Qiang's application structure for large applications with an added www/ directory at the same level as admin/, console/, common/, and public/. This allowed the latter four directories to remain protected using the original protected .htaccess. www/ is web accessible and structured as so:

/admin/
/common/
/console/
/public/
/www/
        admin/
            images/
            themes/
               classic/
                   css/
                       layout.css
                       style.css
                       index.htm
                   images/
                       logo.png
                       index.htm
                   js/
                       classic.js
                       index.htm
                   views/
                       index.htm (also for all view subdirectories)
                   classic.tpl
                   classic.png
                   index.htm
             .htaccess
             index.php
        public/
            images/
            themes/
               classic/
                   css/
                   images/
                   js/
                   views/
                   classic.tpl
                   classic.png
             .htaccess
             index.php


Most of my applications are intermediate to large in size and above works fine for me. The above is very extensible if I need to add other application beyond admin and public (e.g., subdomains).
0

#19 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 665
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 05 February 2012 - 12:37 AM

View Postmmx, on 04 February 2012 - 07:31 PM, said:

But, if a theme is an installable item in your application, it makes sense to keep all associated files together.


Yes. I have thought of it, too.
But in this case CAssetManager may help.

View Postmmx, on 04 February 2012 - 07:31 PM, said:

including an empty index.htm in the other directories


This is called Security through obscurity. Not recommended to rely on that.
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