DooPHP IRC channel


Directory structure descriptions

Discussion about installation and environment issues.

Directory structure descriptions

Postby wrlee » Thu Jul 15, 2010 7:56 pm

Is there a single place where use of all the directories are described? I've seen and think I understand the config, controller, model, view/viewc directories, but I do not understand what the cache, class, global, and tools directories are for.

If I have some php files which should be global to my app (to be included/required by files that are in the config, controller, model, viewc directories). Where should I put them? For the moment, I am calling set_include_path() and appending a path to one of the project folders, but I did not know if this was necessary... is one of the directories already designated for that? It would seem that the global directory might be the right place, but that did not work.

I assume that the class directory holds files that contain class definitions that can be loaded using Doo::loadClass(). Is there any special structure to those files? Any limitations (e.g., it can only contain a single class declaration and nothing else)? What happens to definitions in those files that are not part of the class definition itself?

On a loosely related note, It seems that files in view are written to viewc during runtime. is that expected? That means that I cannot have an HTML file in view that shares the same name as a PHP file in viewc with the same filenames. I wuold have assumed that the cache directory would be the place for view files to be rewritten.

If the answers have been published elsewhere, I'd be just as happy to have links to those resources so that you do not need to repeat the answers here.
wrlee
 
Posts: 52
Joined: Sun Jul 04, 2010 7:48 pm

Re: Directory structure descriptions

Postby RichardM » Fri Jul 16, 2010 12:05 am

Hi,

Most of the things you list here are fairly common in MVC architectures / Frameworks...If you do not understand these then it might be worthwhile going back to basics.

Where do you put your code? in PHP classes you store in the class folder. You can use subfolders so you might have a protected/class/group_name/MyClass.php and load the class by calling Doo::loadClass('group_name/MyClass') and then in your code you can have $myClass = new MyClass(); If your using a third party libary its up to you where you place it and down to you instantiating any autoloader etc to load its classes etc and set it up. You would do this from your controller that needs it or a class if you want to use it in multiple places.

Structure if up to you...safest option to take at this time is one file = one class definition. You can have subfolders for classes to reside in. Then load them as per example above.

If you want to use the template engines then you do not put any files in viewc yourself...as you say DooPHP will compile the templates down for you. If you want to hard code views you can bypass using templates in the view folder and write pure php/html files in viewc and include these...search forums for examples of this. Cache folder is for file caching including partial and full page caching (ie. Rendered views...not compiled templates)

global is intended for shared page resources like css, js, swf, images etc from what I recall. I do not use this in my own projects...I have my own directory structure which works better for me.

tools is for tools provided with DooPHP for reviewing logs etc...I do not use these. See demo app for these...if you do not need/use them delete them.


Richard
Note: code samples my not be 100% accurate.
RichardM
 
Posts: 1329
Joined: Sun Aug 30, 2009 6:03 pm
Location: Cumbria, UK

Re: Directory structure descriptions

Postby wrlee » Fri Jul 16, 2010 7:27 pm

Thank you Richard. Yes, I was familiar with the purpose of the (M)odel, (V)iew(c), and (C)ontroller directories. :-) Your explanations were useful in that they clarified the intent of the others.

In particular, I was unaware that the framework distinguishes between template processing and compiling pages to the cache. Is the template engine plug-replaceable? I noticed, later that I'd forgotten to mention the plugin and module directories. Are these specifically for extending the default templating engine? If not, what are those for? Is there any documentation on how those work?
wrlee
 
Posts: 52
Joined: Sun Jul 04, 2010 7:48 pm

Re: Directory structure descriptions

Postby roman » Sat Jul 17, 2010 5:43 am

wrlee wrote:Is the template engine plug-replaceable?

I use PHPTAL with this framework as a template engine.
roman
 
Posts: 442
Joined: Sat Aug 01, 2009 8:31 pm

Re: Directory structure descriptions

Postby RichardM » Sat Jul 17, 2010 10:06 am

plugin only contains one file 'normally' which is TemplateTags which is a class containing functions you can access from you views when using the doo php template engines.

module is for use with moducles developed for use with your app. Search forums for HMVC and should get you started.


Richard
Note: code samples my not be 100% accurate.
RichardM
 
Posts: 1329
Joined: Sun Aug 30, 2009 6:03 pm
Location: Cumbria, UK


Return to Installation & Setup

Who is online

Users browsing this forum: No registered users and 0 guests