Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Creating a CMS

  1. #1
    albeva is offline Junior Member
    Join Date
    May 2007
    Posts
    26

    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

  2. #2
    SpotSec's Avatar
    SpotSec is offline Senior Member
    Join Date
    Feb 2007
    Location
    United States
    Posts
    122

    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
    Zym Framework - A Zend Framework extension library w/ demo app

    SpotSec Blog:
    http://spotsec.com/blog

  3. #3
    albeva is offline Junior Member
    Join Date
    May 2007
    Posts
    26

    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.

  4. #4
    SpotSec's Avatar
    SpotSec is offline Senior Member
    Join Date
    Feb 2007
    Location
    United States
    Posts
    122

    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.
    Zym Framework - A Zend Framework extension library w/ demo app

    SpotSec Blog:
    http://spotsec.com/blog

  5. #5
    albeva is offline Junior Member
    Join Date
    May 2007
    Posts
    26

    Default

    tnx for the links. your project code looks nice.

  6. #6
    santouras is offline Junior Member
    Join Date
    Jun 2007
    Location
    perth, australia
    Posts
    11

    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

  7. #7
    Maugrim The Reaper is offline 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
    Last edited by Maugrim The Reaper; 06-13-2007 at 08:07 AM. Reason: bad choice of words in a sentence

  8. #8
    ronnystalker is offline Junior Member
    Join Date
    Jul 2007
    Posts
    4

    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

  9. #9
    SpotSec's Avatar
    SpotSec is offline Senior Member
    Join Date
    Feb 2007
    Location
    United States
    Posts
    122

    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
    Zym Framework - A Zend Framework extension library w/ demo app

    SpotSec Blog:
    http://spotsec.com/blog

  10. #10
    admin is offline Administrator
    Join Date
    Jan 2007
    Posts
    21

    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...

Page 1 of 2 12 LastLast

Similar Threads

  1. Creating dynamic URL
    By aniketto in forum General Q&A on Zend Framework
    Replies: 3
    Last Post: 12-22-2008, 01:29 AM
  2. Creating a backdoor
    By GWTommy in forum Authentication & Authorization
    Replies: 2
    Last Post: 12-18-2008, 09:13 AM
  3. Creating a URL, without the GET variables.
    By Naish. in forum Model-View-Controller (MVC)
    Replies: 2
    Last Post: 12-11-2008, 11:30 PM
  4. Creating a URL, without the GET variables.
    By Naish. in forum Model-View-Controller (MVC)
    Replies: 0
    Last Post: 12-04-2008, 05:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •