James Sheffer Re: My flavor of Knop file structure
Mar 10, 2009; 06:00
James Sheffer
Re: My flavor of Knop file structure
Jolle-
My eyesight is still fuzzy from having just woken up, and I haven't had more than a few sips of coffee so I really shouldn't be writing this email, but...
One of the MAJOR things I've been wanting to achieve, and to a small degree have been successfull, Is to write what I consider a "framework" for particular sites. An example is an administrative section. Most of my sites use a "client admin" section that is relatively the same for each site. Add pages, edit pages and reports. Still, I end up spending what I consider too much time re-writing this each time. I've got a lot of it running generically, ie. I have a separate config file that keeps a lot of the different database, password, etc info that is called via set variables throughout the site.
I could be way off base (see the first line), but it sounds like with the "site specific" config files, you can have a site that works "as is" with all the features you would need, then customize it with the site config files (cfg_mine.inc and the others in the _site folder) for each specific client, turning on or off specific features, adding custom things specific for that clients, etc.
Now I'm getting excited!
James
On Mar 10, 2009, at 5:05 AM, Jolle Carlestam wrote:
> Since James is starting his Knop exploration tour I thought I might > share how I organise my Knop sites. > > First of I run a strict onefile system. > > Any request is routed to one of two files. > > Using an AtBegin handler I send all traffic that doesn't > specifically ask for a known resource to an index.lasso file. > That is, stuff that's NOT an image, a named file like testme.lasso > or plain.html etc are sent to index.lasso. > Another lasso file I keep at root level is ajax.lasso. I use that > for ajax calls since they usually demand special treatment. > > The last root level lasso file is error.lasso. It steps in if > there's an error instead of Lassos built in error page and has no > specific relation to Knop. > > All other lasso resources are hidden in a _site folder. > > Here's a listing of a typical root level: > _site/ > error.html > index.lasso > img/ > css/ > debug/ > error.lasso > ajax.lasso > js/ > > Lean and clean if you ask me. > > The folder _site is protected using an Apache directive that > prohibits Apache to access any content found within a folder > starting with an underscore. That prevents villains from getting > hold of my lasso stuff even if Lasso should be down. > Here's the listing for the _site folder: > _action/ > _ajax/ > _config/ > _content/ > _knop/ > _library/ > _template/ > _include/ > > _action/, _config/, _content/ and _library/ are standard Knop > directories. > > I've added _ajax/, _template/ and _include/ as part of my own > standard. > > The folder _knop/ is a special case and has a special meaning for > the Knop_nav object. > When nav object is triggered it does a quick file survey of all > files available within the siteroot. Siteroot in my case is the > _site folder pointed to using a variable. The nav object uses the > survey info to build an internal list of all resources. It knows to > look for stuff in the folders _action, _config, _content and > _library. But if it discovers a _knop folder inside the siteroot it > will also survey the content of _knop. > I use that to my advantage. The folder _knop is actually a symbolic > link pointing to a directory that's shared between all the Knop > sites present on the server. It gives me an easy way to share all my > common Knop resources and at the same time allow client specific > exceptions. > First lets see what I keep inside _knop: > _action/ > _ajax/ > _config/ > _content/ > _library/ > > Note that it mimics part of the layout found in the _site folder. > > Now we'll look at how the _site/_config directory looks like: > _siteconfig.inc > cfg__nav.inc > cfg_mine.inc > > The two first files are always client specific. _siteconfig.inc > contain a bunch of vars that's always set and usually differs > between different clients. Like database name, passwords etc. > cfg__nav.inc builds the nav object. And since different clients use > different subsets of my application it's client specific. > > Here's the listing from _site/_knop/_config (somewhat shortened in > this example): > cfg__global.inc > cfg__language.inc > cfg__security.inc > cfg_article_articleedit.inc > cfg_article_articlelist.inc > cfg_mine.inc > > Notice that there's a cfg_mine.inc in here too. > Let's first say that someone wants to edit an article by using an > URL like mydomain.tld/article/articleedit/298widjso834 (The last > part is the id of the record that we want to edit). > Knop nav will transform the URL to article_articleedit with > 298widjso834 as a param and start including the different parts > beginning with cfg_article_articleedit.inc (followed by > lib_article_articleedit.inc and cnt_article_articleedit.inc). Since > there's no cfg_article_articleedit.inc found in the _site/_config > folder it will use the file found in _site/_knop/_config. > > If we on the other hand navigates to mydomain.tld/mine there's two > files Knop knows about _site/_config/cfg_mine.inc and _site/_knop/ > _config/cfg_mine.inc. > And here comes the beautiful part. The local file _site/_config/ > cfg_mine.inc will override the one found in _knop and thus I can > easily supply client specific twists by simply add a specialised > version in the _site folder. > I can even mix them. > It's for example possible to have a local config file and still use > the shared action file. > > > This is a snippet of how I use the Knop file structure. I know that > the Knop nav object is open for a variety of other ways. Johan has > tried to accomodate a number of possible methods to name and > structure your files but I've never used them and I'm not the right > person to tell about them. > If you don't like it my way ask Johan about the alternatives. > > HDB > Jolle > > -- > ############################################################# > This message is sent to you because you are subscribed to > the mailing list <knop@lists.montania.se>. > To unsubscribe, E-mail to: <knop-off@lists.montania.se> > Send administrative queries to <knop-request@lists.montania.se> > List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html > Project homepage http://montania.se/projects/knop/ > Google Code has the latest downloads at http://code.google.com/p/knop/
-- ############################################################# This message is sent to you because you are subscribed to the mailing list <knop@lists.montania.se>. To unsubscribe, E-mail to: <knop-off@lists.montania.se> Send administrative queries to <knop-request@lists.montania.se> List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html Project homepage http://montania.se/projects/knop/ Google Code has the latest downloads at http://code.google.com/p/knop/
Mar 10
Jason Huck Re: My flavor of Knop file structure
Mar 10, 2009; 08:18
Jason Huck
Re: My flavor of Knop file structure
Mar 10
James Sheffer Re: My flavor of Knop file structure
Mar 10, 2009; 09:19
James Sheffer
Re: My flavor of Knop file structure
Mar 10
Jolle Carlestam My flavor of Knop file structure
Mar 10, 2009; 11:05
Jolle Carlestam
My flavor of Knop file structure
Mar 10
Jolle Carlestam Re: My flavor of Knop file structure
Mar 10, 2009; 12:13
Jolle Carlestam
Re: My flavor of Knop file structure
Mar 10
Jolle Carlestam Re: My flavor of Knop file structure
Mar 10, 2009; 12:52
Jolle Carlestam
Re: My flavor of Knop file structure
Search
Lasso Programming
This site manages and broadcasts several email lists pertaining to Lasso Programming and technologies related and used by Lasso developers. Sign up today!