Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-27-2007, 09:32 PM
Junior Member
 
Join Date: May 2007
Posts: 22
Default Creating a CMS

Okay I am creating a new CMS system. But I have a general question about Zend - what is the best coding / application design practice using it?

I know views should keep only displaying code (and in fact I integrated smarty so...), controller should be like a bridge between user and the system?

and where and how should core logic be placed? Right now I have simply a folder in the root that contains my classes that interact with database and other such (classes that do actual work)

Sry if I am confusing... I am not asking coding help - rather advise how to structure and lay out the code in Zend - what is best practice todo that.

tnx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-28-2007, 07:25 AM
SpotSec's Avatar
Senior Member
 
Join Date: Feb 2007
Location: United States
Posts: 115
Default

Hi,

Zend uses the standard mvc design pattern, so if you haven't read up on this, then I suggest you do some serious researching . At the moment zf doesn't restrict you to a certain structure, but does give recommendations.

If you haven't read up on these:
Zend Framework
Zend Framework Tutorial — a/r/t by php|architect
PHP Coding Standard (draft) - Zend Framework Development - Zend Framework Wiki <-- standards are great... make sure do have one
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-28-2007, 03:02 PM
Junior Member
 
Join Date: May 2007
Posts: 22
Default

Tnx.

I've read through all of this before. I think it would be very useful if there was some sort of example application using Zend taht would conform to the "best practices" of ZF. include say few controllers, plugins and modules. and well documented... it would help a lot for people to get started. Or who wonder how to code using Zend.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-28-2007, 05:15 PM
SpotSec's Avatar
Senior Member
 
Join Date: Feb 2007
Location: United States
Posts: 115
Default

Ok, I see
The problem at the moment is that zend is still in beta and there are not that many application built. There are a few examples on Zend Framework Tutorial*Zend Framework Tutorial, but I must say that most of them are very simplistic or only show one way of doing things. The best way to learn how to do things is to read the zf manual ('has some examples') and read the code.

Personally I would try and look at other peoples code and see what they did that is better since, there are several ways to do things ('more so than most frameworks').
These are examples from zend, but not a specific way of doing things:4. MVC - Models, Views, Controllers - Zend Framework Development - Zend Framework Wiki
You could look at this FishEye: browsing spotsecng/, but I warn you that the code probably won't make sense to you because parts are it left broken due because is a project I'm working on during my free time and parts are not committed to svn yet... At least the controller, plugins, modules are working though, just ignore anything about Zend_Auth and Zend_Acl. Another thing is that you will notice that's different is there is no use of Zend_Db.

Last edited by SpotSec : 05-28-2007 at 05:25 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-29-2007, 08:29 PM
Junior Member
 
Join Date: May 2007
Posts: 22
Default

tnx for the links. your project code looks nice.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 06-13-2007, 03:45 AM
Junior Member
 
Join Date: Jun 2007
Location: perth, australia
Posts: 10
Default

My own project is a little convoluted in its directory setup as its quite large in scope, but I would imagine that this would be a good setup.

My personal recommendation is to define a "cms" or "admin" module that can keep your admin editing in a seperate directory structure from your frontend normal display code. Of course, all this is up to your personal preference.

As such, I would impliment a folder setup per suchly

Code:
/application
../controllers
../cms
..../controllers
../files
..../classes -- in here goes any custom classes you might write, like image handling etc etc
../views
For my own application I have an init file inside my /appplication/files directory that loads up ZF, initialises user classes, logs people in, database connections etc.etc. I find this to be the easiest and most elegant file structure to use
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 06-13-2007, 08:05 AM
Maugrim The Reaper's Avatar
Junior Member
 
Join Date: Jun 2007
Location: Ireland
Posts: 20
Default

The Zend Framework being at Beta/RC means we are weeks/months away from complete fully functional applications that advocate a "final" best practice. Until then there's a bit of guesswork involved , and everyone has their own way. One thing I do suggest is finding out about the Zend Framework conventions.

Conventions are essential in understanding how the framework developers intend the framework to be used and would have a significant bearing on a final directory structure. For example:

Conventional Modular Directory Structure

Not obeying the conventions has consequences. The more you depart from a convention, the more configuration and (hopefully unlikely!) subclassing may be needed to make the framework work the exact way you want it to. Another essential View convention was introduced with the ViewRenderer action helper which is enabled by default. It advocates defaults for template naming, view locations, and even the expected class-prefix for custom helpers and filters. Departing from these is troublesome to say the least. I stuck a quick solution guide on my blog a few days ago since it was creating havoc for some folk.

It would be best to ask more specific questions as you get started. These general pieces of advice don't always give you exactly what you're looking for . I'd definitely start with the conventions, stick with them, and from these a lot of other things will fall into place more easily.

I have a tiny (read: deliberately miniscule tutorial app) application I recently updated for the ViewRenderer introduction. Because I did not know about this newly created View convention I had to re-configure it in my bootstrap file. Most of the directory structure is standard for a few of my more recent projects. Might be of some limited help.

Revision 14: /trunk
__________________
Pádraic Brady

http://blog.astrumfutura.com

Last edited by Maugrim The Reaper : 06-13-2007 at 08:07 AM. Reason: bad choice of words in a sentence
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 07-25-2007, 06:34 AM
Junior Member
 
Join Date: Jul 2007
Posts: 1
Default

Quote:
Originally Posted by Maugrim The Reaper View Post
The Zend Framework being at Beta/RC means we are weeks/months away from complete fully functional applications that advocate a "final" best practice. Until then there's a bit of guesswork involved , and everyone has their own way. One thing I do suggest is finding out about the Zend Framework conventions.

Conventions are essential in understanding how the framework developers intend the framework to be used and would have a significant bearing on a final directory structure. For example:

Conventional Modular Directory Structure

Not obeying the conventions has consequences. The more you depart from a convention, the more configuration and (hopefully unlikely!) subclassing may be needed to make the framework work the exact way you want it to. Another essential View convention was introduced with the ViewRenderer action helper which is enabled by default. It advocates defaults for template naming, view locations, and even the expected class-prefix for custom helpers and filters. Departing from these is troublesome to say the least. I stuck a quick solution guide on my blog a few days ago since it was creating havoc for some folk.

It would be best to ask more specific questions as you get started. These general pieces of advice don't always give you exactly what you're looking for . I'd definitely start with the conventions, stick with them, and from these a lot of other things will fall into place more easily.

I have a tiny (read: deliberately miniscule tutorial app) application I recently updated for the ViewRenderer introduction. Because I did not know about this newly created View convention I had to re-configure it in my bootstrap file. Most of the directory structure is standard for a few of my more recent projects. Might be of some limited help.

Revision 14: /trunk
Re:"and even the expected class-prefix for custom helpers and filters."

I've been reading the documentation at
Zend Framework: Documentation
and I'm still a bit confused about the conventions on naming helper files (and when to choose to make a custom helper file rather than a plugin, just a straight class of my own, or something that goes into the model folder.)

For example, are helpers seperated into actionHelpers and ViewHelpers, and if so, why does there only seem to be one directory named helpers (under views as seen at: Zend Framework: Documentation )?

If anyone can give me an example of a directory structure that involves custom helpers, it would be most helpful.

As has been previously discussed in this thread, I would like to reap the benefits of following as much convention as possible.

Re: "It would be best to ask more specific questions as you get started."
I'm with Albeva on this: Sometimes its nice to see/discuss the bigger picture. This often has the effect of enabling the newbie (like myself) to have the ability to deduce the answers to many specific questions in one go.

Last edited by ronnystalker : 07-25-2007 at 06:47 AM. Reason: adding more detail
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 07-26-2007, 02:40 AM
SpotSec's Avatar
Senior Member
 
Join Date: Feb 2007
Location: United States
Posts: 115
Default

there are two types of helpers, action helpers, and view helpers. They are completely different.

Plugins
- Most powerful
Action helpers
- Less powerful, more specific
View helpers
- Even less powerful and more specific to the view
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 07-30-2007, 05:19 PM
Administrator
 
Join Date: Jan 2007
Posts: 11
Default

I think i need to re-think a bit my code too, i am developing atm a CMS for sites but i don't use lot of the new features...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 07:16 PM.