SitePoint Sponsor

User Tag List

Page 2 of 4 FirstFirst 1234 LastLast
Results 26 to 50 of 81
  1. #26
    SitePoint Zealot
    Join Date
    May 2005
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I generally work to the MVC principal but not actually using the framwork - i say that because i split everything up so i have all templates in one file, classes in another and modules in another and my index.php file normally ends up being quite short. Its easy to get to the desired files then.

  2. #27
    Twitter - @CarlBeckel busy's Avatar
    Join Date
    May 2004
    Location
    Richmond, VA, USA
    Posts
    819
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by xmitchx View Post
    Agreed. I follow the ZF naming, coding, and testing conventions. It keeps my projects clean and uniform even if I'm not using the ZF.
    I read through it
    http://framework.zend.com/manual/en/...-standard.html

    I'm not strict with it, but I've picked up some habits I learned there. At least it helped me better understand the importance of consistency in my code and I have my own conventions now. I recommend anyone else to have a look.

    I have a pretty simple folder structure for my projects

    /class <-- classes
    /doc <-- documentation
    /etc <-- config files
    /func <-- stand-alone functions
    /inc <-- other include files (usually just a file that had definitions for HEADER and FOOTER constants, and a few other things that I don't think belong in my config files. Sometimes other stuff ends up here too)
    /www <-- web root
    /www/images <-- duh
    /www/cssjs <-- css and js files, and for some reason I always stick random things that don't belong in here

  3. #28
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    368
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use my own framework and other frameworks such as zend


    /server/ <---root directory for security reasons all 3rd party code is installed/runs only here, everythign is run under reduced privelege user:group with apparmor thrown around!

    /server/tmp/ <--temp cache used by all applications, uses ramdisk for extra speed!

    /server/var/ <--root directory for my and 3rd party frameworks
    /server/var/zend_1.0.1/
    /server/var/myframework_0.9.0/

    /server/servers/ <--mysql, php, lighttpd, nginx and so on is manually compiled with required packages only


    /server/apps/ <--root directory for web applications


    /server/apps/www.example.com/ <--root directory for web application project


    /server/apps/www.example.com/httpdocs/ <--http root folder for the application

    /server/apps/www.example.com/bin/ <--scripts such as cron, sockets servers and so on

    /server/apps/www.example.com/tmp/ <--application only cache

    /server/apps/www.example.com/modules/ <--application modules (controllers)

    /server/apps/www.example.com/classes/ <--application classes (models)

    /server/apps/www.example.com/var/ <--various items for the application such as error pages, master templates and so on

  4. #29
    Floridiot joebert's Avatar
    Join Date
    Mar 2004
    Location
    Kenneth City, FL
    Posts
    823
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    However the project I'm working on organizes them.

    I'm pretty flexible.

  5. #30
    SitePoint Wizard mcsolas's Avatar
    Join Date
    Jul 2004
    Location
    Hermosa Costa Rica
    Posts
    1,710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have studied how many foss projects implement folder structure.

    Drupal has one of the cleanest, most orderly Ive come across.

    Definitely worth a look imo.

  6. #31
    SitePoint Zealot cholmon's Avatar
    Join Date
    Mar 2004
    Location
    SC
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I notice that lots of folks use the one-file-per-class idea, which is great, but the file names are often "className.class.php"...and they all reside underneath a single "classes/" directory. The same goes for files like "inc/fileName.inc.php".

    Why do you bother with these redundant file names if all the files are stored under appropriately named directories? Just curious...
    Drew C King: PHP Developer
    <?= $short_tags++ ?>

  7. #32
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    232
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The following directory structure works pretty well for me:

    Code:
    project
        * app
              o controllers
                    + NewsController.php
                    + 
              o etc
                    + schemas
                    + config.ini
              o jobs
              o models
                    + NewsModel.php
              o plugins
              o templates
                    + news
                          # add.html
                          # edit.html
                          # list.html
                    + 
              o application.php
        * libs
              o Smarty
              o Zend
              o 
        * public_html
              o css
              o images
              o js
              o .htaccess
              o bootstrap.php
        * tests
              o NewsTest.php
        * tmp
              o cache
              o templates_c

  8. #33
    SitePoint Enthusiast
    Join Date
    Feb 2007
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't have to do anything , but to know what do UML means ...

    http://www.google.com/search?q=uml

  9. #34
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Wow. I'm surprised by how many directories people have in their directory structures.

    I haven't got into the whole MVC thing (I don't quite get it or the advantages of it - seems just like the 'in' thing at the moment). I could be persuaded though, but it seems awfully bloated to me.

    I use:

    Code:
    /project
    /project/lib
    /project/lib/classes
    /project/httpdocs
    /project/httpdocs/images
    /project/httpdocs/includes
    /project/httpdocs/scripts
    /project/httpdocs/styles
    (substitute httpdocs for public_html, wwwroot or whatever the server I'm using requires - obviously this is the directory the domain 'points' to)

    In my lib folder I have an include file, generally inc.projectname.php, which then includes all of the other functions / general classes / config file / constants definitions / initialisation scripts (which go in lib) and project specific classes (which go in lib/classes). The httpdocs folder is pretty self explanatory. I sometimes separate my content images from my design / layout images as well with a content/ folder inside the images folder. includes/ has all the inc.header.php, inc.footer.php, inc.nav.php etc - that are all just include()'d by the scripts themselves. Scripts has any javascript files i might use, styles any css files (usually use a main one for layout, then a separate file for each separate part of an application, like a calendar or something).

    I guess one thing about it is that all the classes are loaded on every page - but I don't see this as a great bottleneck. Surely the limiting factor is the downloading of the final result by the client, rather than how much php is executed? I just love the simplicity of being able to include a single file at the top of every httpdocs page (require_once('../lib/inc.projectname.php');) - I could try autoloading though I guess?

  10. #35
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,095
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    I find it interesting so many PHP developer have jumped into the MVC model, it's good to see.

  11. #36
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A genral problem, thanks for replies, they helped me.

  12. #37
    SitePoint Addict
    Join Date
    Aug 2007
    Location
    GR
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stormrider View Post
    Wow. I'm surprised by how many directories people have in their directory structures.

    I haven't got into the whole MVC thing (I don't quite get it or the advantages of it - seems just like the 'in' thing at the moment). I could be persuaded though, but it seems awfully bloated to me.
    I'm with you. When you want to use a php file you include it in the calling page, so all php files fall into the category "includes".

  13. #38
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stormrider View Post
    I haven't got into the whole MVC thing (I don't quite get it or the advantages of it - seems just like the 'in' thing at the moment). I could be persuaded though, but it seems awfully bloated to me.
    It's like all things in object oriented programming. You're trading complexity for low coupling and high reusability.

  14. #39
    SitePoint Member
    Join Date
    Dec 2004
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It all depends on the size of your project. I only use PHP 5 OOP if it is a big application and want encapsulation, because unnecessary OOP slows down your app. Keep it simple and develop your own style. Why be a follower, when you can be an innovator. Think about what you are trying to accomplish and do what YOU think works best. Function files or libraries work just as good as class files or libraries organization. The key is to save time by reusing code as much as possible.

  15. #40
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Most of my projects are pretty lightweight so I keep it very simple.
    function files and application files occasionally I will call a function from the function file I wrote for a different application file and usually there is a function file that contains all of the sites connection and authentication functions that I call from nearly all the application scripts.
    If job is more complex than that I go with Zend, but I am considering CI, Cake, and Sym.

  16. #41
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    368
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OOP slows down your app
    can you show us a benchmark and not just throw words up in the air

  17. #42
    Not yet perfect mattalexx's Avatar
    Join Date
    Oct 2005
    Location
    Taos, NM, US
    Posts
    441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <cache>                 [uploaded images, tmp dir, cache folders, etc. Every subfolder has 0777 permissions]
    <dev>                   [phpinfo, test scripts, development junk drawer]
    <include>               [included files; resources]
       <css>
          style.css         [General styles]
          site.css          [styles that are specific to this site]
          site_cms.css      [styles that are specific to the cms]
          site_front.css    [styles that are specific to the front layout]
       <flash>
       <fonts>
       <images>
          <layout>          [static images used in layout]
          <silk_icons>      [gotta have 'em. http://www.famfamfam.com]
       <js>
          <prototype>
          lib.js            [General JS helper functions]
          site.js           [JS that's specific to this site]
       <php>                [PHP classes and functions]
          <Export>
          <Form>
          <ImageGen>
          <Mail>
          <MySQL>
          <OpenSSL>
          <Page>
          <ShoppingCart>
          <SmartLoader>
          <Thumb>
          <Uploader>
          lib.debug.php     [debug functions]
          lib.functions.php [General PHP helper functions]
          lib.site.php      [PHP functions specific to this site]
       <scripts>            [misc files that are usually fetched with require_once or get_file_contents]
       config.php
       init.php             [auto_prepended in .htaccess]
    <pages>                 [contains all of the actual pages in the site. Mod Rewrite is used extensively
       <cms>                [CMS pages]
          index.php
       <front>              [Front pages]
          index.php
    .htaccess
    robots.txt
    Matt Alexander
    Alexander Site Design

  18. #43
    Not yet perfect mattalexx's Avatar
    Join Date
    Oct 2005
    Location
    Taos, NM, US
    Posts
    441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [QUOTE=jamesm6917;3530835]
    Quote Originally Posted by jamesm6917 View Post
    Function files or libraries work just as good as class files or libraries organization.
    I think you might be using classes in the wrong way if you believe this to be true.
    Quote Originally Posted by jamesm6917 View Post
    The key is to save time by reusing code as much as possible.
    Right, which is why classes are better than function libraries.
    Matt Alexander
    Alexander Site Design

  19. #44
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    260
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone place files in subfolders to further categorize them and prevent clutter, such as:
    Code:
    /library/transferobject/
    /library/transferobject/user.php
    /library/transferobject/user/detailed.php
    /library/transferobject/order.php
    /library/transferobject/order/detailed.php
    /library/mapper/user.php
    /library/mapper/order.php
    A large bulk of my scripts are transfer object type classes, but I don't prefix...
    Code:
    /library/transferobject/user.php
    ...or suffix them...
    Code:
    /library/user/transferobject.php
    into defined directory structures.

    This causes a lot of mixing between these classes and classes that actually perform "work", such as:
    Code:
    /library/user.php
    /library/user/mapper.php
    /library/order.php
    /library/order/mapper.php
    How do you deal with this type of clutter and organization when you get deeper into the folder structure?

  20. #45
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Code:
    /
    /apps
    /apps/w3counter
    /apps/w3counter/cache
    /apps/w3counter/config
    /apps/w3counter/config/app.yml
    /apps/w3counter/config/cache.yml
    /apps/w3counter/config/config.yml
    /apps/w3counter/config/factories.yml
    /apps/w3counter/config/filters.yml
    /apps/w3counter/config/i18n.yml
    /apps/w3counter/config/logging.yml
    /apps/w3counter/config/routing.yml
    /apps/w3counter/config/security.yml
    /apps/w3counter/config/settings.yml
    /apps/w3counter/config/view.yml
    /apps/w3counter/lib
    /apps/w3counter/lib/authnet.class.php
    /apps/w3counter/lib/authnetArb.class.php
    /apps/w3counter/lib/fusionChart.class.php
    /apps/w3counter/lib/googleMap.class.php
    /apps/w3counter/lib/searchParse.php
    /apps/w3counter/lib/wcPagedDataSet.class.php
    /apps/w3counter/lib/wcUser.class.php
    /apps/w3counter/lib/utf8ConnectionFilter.class.php
    /apps/w3counter/lib/rememberMeFilter.class.php
    /apps/w3counter/lib/publicStatsAuthFilter.class.php
    /apps/w3counter/lib/helper
    /apps/w3counter/lib/helper/StatFormatHelper.php
    /apps/w3counter/modules/
    /apps/w3counter/modules/live
    /apps/w3counter/modules/live/actions
    /apps/w3counter/modules/live/actions/actions.class.php
    /apps/w3counter/modules/live/actions/components.class.php
    /apps/w3counter/modules/live/config
    /apps/w3counter/modules/live/config/security.yml
    /apps/w3counter/modules/live/config/view.yml
    /apps/w3counter/modules/live/templates
    /apps/w3counter/modules/live/templates/onlineSuccess.php
    /apps/w3counter/modules/live/templates/onlineTable.php
    /apps/w3counter/modules/live/templates/referrersSuccess.php
    /apps/w3counter/modules/live/templates/referrersTable.php
    /apps/w3counter/modules/live/templates/searchesSuccess.php
    /apps/w3counter/modules/live/templates/searchesTable.php
    /apps/w3counter/modules/admin
    ...
    /apps/w3counter/modules/api
    ...
    /apps/w3counter/modules/auth
    ...
    /apps/w3counter/modules/content
    ...
    /apps/w3counter/modules/navigation
    ...
    /apps/w3counter/modules/rss
    ...
    /apps/w3counter/modules/sources
    ...
    /apps/w3counter/modules/visitors
    ...
    /apps/w3counter/modules/websites
    ...
    /apps/w3counter/templates
    /apps/w3counter/templates/ajax_layout.php
    /apps/w3counter/templates/account_layout.php
    /apps/w3counter/templates/stats_layout.php
    /apps/w3counter/templates/_footer.php
    /apps/w3counter/templates/_headerbar.php
    /apps/w3counter/templates/_navbar.php
    /apps/w3counter/templates/_paging.php
    /apps/w3counter/templates/_modetabs.php
    /apps/w3counter/templates/_site_switcher.php
    /cache
    ...
    /config
    /config/config.php
    /config/databases.yml
    /config/propel.ini
    /config/properties.ini
    /config/schema.yml
    /css
    /css/main.css
    /css/public.css
    /data
    /data/sql
    /data/sql/lib.model.schema.sql
    /data/symfony
    ...
    /doc
    /images
    /images/charts
    ...
    /images/icons
    ...
    /images/counters
    ...
    /js
    /js/FusionCharts.js
    /js/ClickOverlay.js
    /lib
    /lib/PeerUtils.class.php
    /lib/model
    /lib/model/AdminPeer.php
    /lib/model/Feed.php
    /lib/model/FeedPeer.php
    /lib/model/LogEntry.php
    /lib/model/LogEntryPeer.php
    /lib/model/Style.php
    /lib/model/StylePeer.php
    /lib/model/Summary.php
    /lib/model/SummaryPeer.php
    /lib/model/User.php
    /lib/model/UserPeer.php
    /lib/model/Website.php
    /lib/model/WebsitePeer.php
    /lib/symfony
    ...
    /log
    /log/w3counter_prod.log
    /log/w3counter_dev.log
    /plugins
    /plugins/sfOptimizerPlugin
    ...
    /plugins/sfSslRequirementPlugin
    ...
    /sf
    ...
    /test
    /test/bootstrap
    ...
    /test/functional
    ...
    /test/unit
    ...
    /.htaccess
    /index.php
    /w3counter_dev.php
    /symfony.bat
    /symfony.php
    As long as we're talking file naming conventions now...

  21. #46
    SitePoint Member
    Join Date
    Dec 2004
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [QUOTE=mattalexx;3531446]
    Quote Originally Posted by jamesm6917 View Post
    I think you might be using classes in the wrong way if you believe this to be true.

    Right, which is why classes are better than function libraries.
    I agree that class libraries are better then functions libraries for large projects or for reuse of code.

    However, you can reuse code with functions too. Since all classes are, are containers for functions (methods). Classes slow down applications, its a proven fact, so not in all cases are they good for development. Thanks for your insight, but I know how to use classes.

  22. #47
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jamesm6917 View Post
    Since all classes are, are containers for functions (methods).
    That's wholely untrue.

  23. #48
    SitePoint Member
    Join Date
    Dec 2004
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Grossman View Post
    That's wholely untrue.
    This was just generalization. I was not getting into detail about the purposes and usage of classes.

  24. #49
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

  25. #50
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Malaysia
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by xmitchx View Post
    Agreed. I follow the ZF naming, coding, and testing conventions. It keeps my projects clean and uniform even if I'm not using the ZF.

    This is what I do,

    /public_html/ - Php scripts
    /public_html/tpl/ - Where I put all my .html template files
    /public_html/css/ - CSS files
    /public_html/js/ - Javascript files
    /public_html/img/ - Images
    /lib/ - All library files (Includes php classes to be reused across different sites, when you start a new site, just copy this folder over)
    /app/ - PHP classes only to be used on the site.
    /conf/ - Configurations for the site


Bookmarks

Posting Permissions

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