From: Hank M. <hma...@gm...> - 2006-11-14 19:59:18
|
I agree having index.php?page=foo is ugly ... but I think mod_rewrite (and it's ilk) have taken over the world at this point with respect to clean url implementation and once you understand the magic incantations it's not really so bad. It also seems most of the current frameworks (regardless of language) use it for dispatching from a central script; ie index.php. I do agree with Rich though that on small sites particularly, the whole code / view separation thing is way overblown ... unless code at the top of the page, format at the bottom counts as separation ;) ... I know and respect that that's heresy in most web dev shops, but for little projects it's actually nice that php allows it so cleanly. On 11/14/06, Richard Lynch <ce...@l-...> wrote: > > On Thu, November 9, 2006 8:26 am, Nola Stowe wrote: > > I also have done some rails and it inspired my "Stupidly Easy MVC > > Framework" (links here: http://devasap.net/programming.html) ... and > > in recent weeks I have been looking more closely at Zend > > Framework.Which in itself, is more like PEAR than Rails, but looks > > like it has a nifty MVC Front Controller that works pretty well I > > think. > > I tried to do an MVC thingie (not knowing it was called MVC) back in > PHP3 days... > > And it just ended up having so much cruft in the Controller file, that > I abandoned it and never went back. > > I don't really feel the need for a single Controller when I can > centrally locate the authentication in one include file, the db > connection in another, and pull those both in (or not, sometimes, when > appropriate) through a 'globals.inc' file that handles the masthead > and footer and site-wide layout / navigation. > > Or maybe that *is* my Controller, just done with PHP includes. LOL. > > One issue is that it's a lot easier to tell somebody to go to the > "foo.htm" page (which is PHP, of course) than to go to > "index.php?page=foo" > > Now, of course, you can do all kinds of URL-rewriting tricks in PHP or > (shudder) mod_rewrite in Apache, but I find it easier to just have a > foo.htm page with: > > <?php > require 'globals.inc'; > head("Page Title"); //masthead, navigation, basic layout "shell" > > //page-specific business logic > ?> > Page specific content and presentation logic > <?php > foot(); //closing tags for head() > ?> > > The one-page logic rarely exceeds a screenful, and the HTML layout > might be 2 screens with all the tags and all that, but that's hardly > difficult > > The nice thing about PHP/Ruby/Python and all that is you have a lot of > options, and can use whatever you like best. > > The head() and foot() functions are before/after each other in the > globals.inc file, so the "shell" of the layout reads just like an HTML > page. > > The head() function might also take an extra arg for business-logic > specific purposes, such as a flag to suppress the "usual" layout for > the homepage or perhaps a custom stylesheet to insert into the HEAD > tags for just this one page. > > The head() function may also key off of $_SERVER['PHP_SELF'] which has > foo.htm to put in a link to 'foo.css' if it exists, or perhaps a > foo.png image in the masthead to help them know where they are or > something like that. > > -- > Some people have a "gift" link here. > Know what I want? > I want you to buy a CD from some starving artist. > http://cdbaby.com/browse/from/lynch > Yeah, I get a buck. So? > > > ------------------------------------------------------------------------- > SF.net email is sponsored by: A Better Job is Waiting for You - Find it > Now. > Check out Slashdot's new job board. Browse through tons of technical jobs > posted by companies looking to hire people just like you. > http://jobs.slashdot.org/ > _______________________________________________ > chiPHPug-discuss mailing list > chi...@li... > https://lists.sourceforge.net/lists/listinfo/chiphpug-discuss > |