How do you organize your back-end file wise?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: How do you organize your back-end file wise?

Post by Christopher »

josh wrote:If my memory recalls you have to do nothing, the request object automatically detects base URLs
Except for the part:
Should base URL be detected incorrectly ...
(#10850)
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: How do you organize your back-end file wise?

Post by JAB Creations »

Thank you pytrin, I simply copied the file from the tutorial on this page after correcting my directory structure. I now have an error that seems familiar from the screencast that Josh posted a link to so I think I've moved forward a step.

I think we both practice the same thing where each project on localhost has it's own sub-folder. Here is my setup with a few examples...

http://localhost/Version 1.1/
http://localhost/Version 2.8/
http://localhost/Version 2.9.A.1/
http://localhost/Version 2.9.A.2/
http://localhost/Version 2.9.A.3/
http://localhost/zend/
http://localhost/zend/application/
http://localhost/zend/library/
http://localhost/zend/library/Zend/
http://localhost/zend/public_html/

I'm obviously not going to merge my site to use Zend at such an early stage but this does allow me to have a sandbox to play with it. :)

Here is the shelf I've been working on with a friend that is about 80% complete. It's been taking up a good chunk of my time of late though is necessary in my situation, $43 in supplies. I was a bit concerned when the lady rang the price up as $16 grand though said I'd be happy to take the receipt in order to bring the stuff back. :mrgreen: Once this is done and my spare parts aren't all stacked on top of each other I'll be be able get back to code full time. :)

Any way the error I get with Zend now is...
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)'
I simply need to resume the tutorial at this point though also need to finish a client's computer, the shelf, and organizing all the spare computer parts that will sit on the shelf first. 8)
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: How do you organize your back-end file wise?

Post by Eran »

This error means you haven't created an error controller yet. It's part of the tutorial, so get back to it and you'll be ok :)
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: How do you organize your back-end file wise?

Post by JAB Creations »

I apologize for not keeping up with this thread for the past five weeks though I've slowly come to realize over time what I think I'll have to do to build my own MVC.

As I've been building my site's CMS system I have modules such as the blog and forums. One of tonight's goals has been to reduce the existence of the h1 element to a single occurrence in a single template file. Currently (since I last worked on the blog and forum in November and December of last year) I have all the XHTML code including the headers there. The issue is that while I want to keep the blog and forums as separate modules there is the need for some merging of code, particularly the PHP classes and MySQL queries.

So to successfully have the title and h1 elements be exactly what I want them to be while only each having a single occurrence in all my code I've determined albeit somewhat vaguely that I will need to execute (at least) some of the MySQL queries for those modules and assign the general template values at an earlier step then how they are currently being determined.

I think it's a bit vague though I am pretty certain I'm understanding the concept with a little more clarity.

So in real world application having a single h1 and title element in all my code would be part of the presentation layer.

So here I am looking at this...
http://www.tonymarston.co.uk/php-mysql/ ... l#together

User --> Controller --> Model --> View

User --> The user requests blog or forum page.
Controller --> Controller needs to create PHP classes.
Model --> XHTML template files echos class data determined in the controller.
View --> Sent to the client.

This is my general understanding now...in application to what I want to do.

What I am thinking now is that I have a general CMS class file. How I will determine the h1/title will be different according to the section of my site requested (blog, forums, regular page, etc).

1.) So I first have to dictate the section requested (which I already have).

2.) I have to call up the section specific processing...where I store the title for a blog will likely be different then a forum in example. I determine the variables and eventually assign those variables to the generic $cms class variables.

3.) The model simply being XHTML templates has to simply do something like echo '<title>'.$cms->title.'</title>';.

So in general how accurate/close am I with this example in my mind to how MVC works?
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: How do you organize your back-end file wise?

Post by josh »

A viewscript can use a viewhelper to call 2 models from different modules/packages, I dont think you need to write your own MVC to do that.
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: How do you organize your back-end file wise?

Post by JAB Creations »

I've not heard of 'viewscript' before? I'm experimenting now, hopefully I can do this with an includes/require_once. :)
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Re: How do you organize your back-end file wise?

Post by panic! »

Image
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: How do you organize your back-end file wise?

Post by VladSun »

Model --> XHTML template files echos class data determined in the controller.
Huh?!?
Model should not take response of viewing data in *any* way. That's what View is for.

The View should have access to the Model, take all of the data it needs and format (view) it in an appropriate format (HTML, PDF, etc.).
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply