<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On Oct 9, 2006, at 8:35 AM, The Editor wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">I'm not particularly interested in cut & paste code -- I'm VERY interested in coming up</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">with new recipes, using it to customize data.</FONT></P> </BLOCKQUOTE><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">Part of my goal is to help those like me who don't know PHP but want</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">to be able to do all kinds of interesting things.<SPAN class="Apple-converted-space"> </SPAN>This recipe should</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">make that possible.<SPAN class="Apple-converted-space"> </SPAN>For those who want to hack the code, or use it in</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">different ways, I want to make the code easy to modify.<SPAN class="Apple-converted-space"> </SPAN>For example,</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">if I had been paying attention, I should have suggested you put the</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">simile wrapper actually as a simple conditional in the engine itself.</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">It would have been easier for you and been more in harmony with my</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">original design goal of extensibility.<SPAN class="Apple-converted-space"> </SPAN>I guess I should have</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">explained how to do this.</FONT></P> </BLOCKQUOTE><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR></P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px">I don't want to do that. I want modules I can upgrade without breaking a site. I do understand that things would probably break from FastData2 to whateveryoucallit3 -- that's a major revision -- but I don't want them to break from upgrading due to a security fix. I only hacked the code as you recommended so that it would create data pages that PageLists et al would work with.</P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px">Otherwise I prefer to work in a separate cookbook recipe or in config.php. That's where hacks & customizations ought to be.</P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR class="khtml-block-placeholder"></P><BLOCKQUOTE type="cite"> <BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">One nice thing about the way similepedia.com is using FASTData is that it's NOT being</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">used to retrieve data from pages.<SPAN class="Apple-converted-space"> </SPAN>Only to create the data pages.<SPAN class="Apple-converted-space"> </SPAN>I have one form that</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">uses it.<SPAN class="Apple-converted-space"> </SPAN>I can easily restrict editing on the form page, and have PmWiki ONLY load</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">FASTData when loading the one page... then my security is done...</FONT></P> </BLOCKQUOTE><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">Yes, I wonder if I still even need data retrieval capabilities with</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">the new text variables.<SPAN class="Apple-converted-space"> </SPAN>Very powerful. Same thing, soon, with the</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">logging features (commenting).<SPAN class="Apple-converted-space"> </SPAN>As more and more stuff gets added to</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">core, less and less may be required of FAST Data.<SPAN class="Apple-converted-space"> </SPAN>Which may solve the</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">length problem a different way.</FONT></P> </BLOCKQUOTE><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR></P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px">I am using the new text variables.</P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR class="khtml-block-placeholder"></P><BLOCKQUOTE type="cite"> <BLOCKQUOTE type="cite"></BLOCKQUOTE><BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">Another thing that's important to keep in mind:<SPAN class="Apple-converted-space"> </SPAN>Namespace.<SPAN class="Apple-converted-space"> </SPAN>I've been trying to keep the > vast bulk of my (newer) cookbook recipes within a function or class.<SPAN class="Apple-converted-space"> </SPAN>The problem is that > every time you create a variable you risk bumping into conflicts between your variable</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">name(s) and those of other recipes.<SPAN class="Apple-converted-space"> </SPAN>This also goes for function names.</FONT></P> </BLOCKQUOTE><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">Can you explain what you mean by classes?<SPAN class="Apple-converted-space"> </SPAN>I don't think you can</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">define functions within functions can you?<SPAN class="Apple-converted-space"> </SPAN>And to have values passed</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">between functions you pretty much need globals, unless you pass them</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">as function paramaters.<SPAN class="Apple-converted-space"> </SPAN>Is there much advantage to one or the other?</FONT></P> </BLOCKQUOTE><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px">Classes are a code structure from the object-oriented-programming side of PHP. It usually takes a while to wrap one's head around it. And I've never EVER found a terrific explanation of what classes are.</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px">A class is beyond a function. The class definition creates an ideal "object" (rather than an actual object, that comes later), and assigns it properties (variables) and methods (functions).</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px">Here's the basic class syntax for how I would deal with shoelaces (I'm using comments for a real life action that I don't feel like emulating in real code) -- but note that an "object" does not need to be a physical object -- it could be an email, data, graphics, form buttons, or something even more abstract.</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px">class Shoelaces {</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>$tied = false;</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>$double = false;</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN></P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>function tie_shoelaces () {</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>if ($this->tied) { return; }</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>// instruction to grab shoelaces here</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$this->pull_tight();</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$this->overhand_knot();</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$this->pull_tight();</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$this->make_loop("right");</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$this->make_loop("left");</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$this->overhand_knot();</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$this->pull_tight();</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>if($this->double) { </P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>$this->overhand_knot();</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>$this->pull_tight();</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>}</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>}</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>function pull_tight() {</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>// yank whatever is in your hands in opposite directions</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>}</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>function overhand_knot() {</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>// loop item in right hand around item in left hand one complete rotation</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>// hold item in right hand again</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>}</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>function make_loop($side) {</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>// creates a loop from the left or right side of the lace</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>}</P><P style="margin: 0.0px 0.0px 0.0px 10.0px">}</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px">Here's how you use the class:</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px">// create an object instance -- this is a specific local copy of the class for this specific instance/call. This code would be in the master body of your program -- or in another function</P><P style="margin: 0.0px 0.0px 0.0px 10.0px">$bootlaces = new Shoelaces;</P><P style="margin: 0.0px 0.0px 0.0px 10.0px">// set the properties</P><P style="margin: 0.0px 0.0px 0.0px 10.0px">$bootlaces->tied = false;</P><P style="margin: 0.0px 0.0px 0.0px 10.0px">$bootlaces->double = true;</P><P style="margin: 0.0px 0.0px 0.0px 10.0px">// tie the shoelaces (call the method i.e. execute the function)</P><P style="margin: 0.0px 0.0px 0.0px 10.0px">$bootlaces->tie_shoelaces();</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px">Now you should have a doubleknotted shoelace on your boots. This could be used for sneakers also. Or even hacked for tying laces on other objects.</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px">Now, the parts people have the hardest time wrapping their brain around:</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>Calling it "object" "method" "instance" etc. -- It's a prepackaged set of code, values and actions/functions.</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>the term "this" inside the class definitien -- $this is "$this object" or a place holder for the namespace INSIDE the object.</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px">There is no place to run code in the object without defining a function/method. It's confusing to call it an object method when obviously you're even using the syntax "function" :P</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px">I didn't use it above, but there's also something called a "constructor method" and in PHP5 there's a destructor method. All this means is "automatically run this function when I create the class instance" or a destructor is something auto-run when you destroy the object instance (not sure how, I don't do PHP5 yet -- maybe unset()?)</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px">Syntax for a constructor in PHP4 is to name the constructor function the same name as the class name -- inside the class definition.</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>function Shoelaces() {}</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 10.0px">I know this is probably confusing, so feel free to ask questions. Note however that this completely protects the code and variables of the class from colliding with the names of other items in the program. The only name of concern is the class itself. Other people can use your class pretty easily -- it makes a very portable chunk of code. There's more to it, but this is enough to actually get you using this idea if you decide it would make code more efficient.</P><P style="margin: 0.0px 0.0px 0.0px 10.0px"><BR class="khtml-block-placeholder"></P><BLOCKQUOTE type="cite"><BLOCKQUOTE type="cite"></BLOCKQUOTE><BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">Once your function is defined, your namespace is local instead of global.<SPAN class="Apple-converted-space"> </SPAN>The same</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">goes for objects/classes.<SPAN class="Apple-converted-space"> </SPAN>Much safer in a shared programming environment.</FONT></P> </BLOCKQUOTE><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">Again, I don't really know what you mean by namespace, though I've</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">heard the expression before.<SPAN class="Apple-converted-space"> </SPAN>Help?</FONT></P> </BLOCKQUOTE><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR></P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px">hrm. Ok -- namespace is a term used in regard to labels (names) used for memory/variables in the execution of the code ($a, $fancy, MyFunction()). The "space" portion refers to the scope of the name (local scope, global scope, etc.). Variables in the global namespace would be a list of the variables used in the normal program execution (not within function), or defined as global in a function (if a function is passing information to the global execution by defining a new global variable). In PmWiki's global namespace, Patrick uses $n $pagename and functions like UpdatePage. If you want to iterate through a list and use</P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>for($n=0; $n<5;$n++) {}</P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px">there is going to be a problem in the normal code execution if any other code later is expecting $n to be the old value. This would be a namespace collision. PHP has no good protection against namespace collisions for variables.</P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px">It does for function names though: You can't name a function UpdatePage or you will get an error (if UpdatePage is already defined) or cause PmWiki.php's definition of UpdatePage to generate an error. You can overwrite $pagename and get in trouble during PmWiki execution (or take advantage of it on purpose).</P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px">Variables defined within functions have their own separate namespace. You need to specifically pull in normal global variables or pass information by argument, or use superglobals.</P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px">classes also create new scope for naming variables and functions.</P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px">You may not collide with Patrick's code, but you probably haven't tested your code with every plug-in. If most of your code is inside a function, just make sure the function itself doesn't clash with other potential or existing functions. If you name it "Data" it's more likely to collide than if you name it "FD_Data" -- it's one of the unofficial conventions when creating cookbook recipes -- it should be stressed a bit more for clarity, portability, and allowing the most flexibility in cookbooks:</P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px">1) keep as much code as possible in a protected namespace (class or function)</P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px">2) name said class or function with something to separate it from other recipes or pmwiki code (FD_Data)</P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px">3) the same should go for newly-introduced values that need to be addressed in config.php</P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR class="khtml-block-placeholder"></P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px">Is that helpful?</P><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR class="khtml-block-placeholder"></P><BLOCKQUOTE type="cite"> <BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">A good example of code that should be in an included file for your recipe is the</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">FastData->Database functions.<SPAN class="Apple-converted-space"> </SPAN>I also highly recommend that you follow the discussion</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">of encouraging cookbook cooks to use adodb instead of writing code for a single type of</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">database.<SPAN class="Apple-converted-space"> </SPAN>In any case, not everyone is using a database, and the code may be pretty</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">long.<SPAN class="Apple-converted-space"> </SPAN>If they don't have adodb called before your recipe, your recipe might even break</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">because your database functions are calling on functions / classes that are not defined.</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">If it's in an include, you can check that adodb was loaded AND that the code is needed</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">before loading the database functionality.<SPAN class="Apple-converted-space"> </SPAN>That could save another 500 lines of code from</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">being called.<SPAN class="Apple-converted-space"> </SPAN>;)</FONT></P> </BLOCKQUOTE><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Comic Sans MS; min-height: 16.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">I'm still chewing on whether I want to split up the recipe into</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">modules or keep it all together.<SPAN class="Apple-converted-space"> </SPAN>Haven't come to a conclusion yet.<SPAN class="Apple-converted-space"> </SPAN>I</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">tend to think the easiest is having those concerned about performance</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">simply delete any functions they don't need.<SPAN class="Apple-converted-space"> </SPAN>Perhaps a bit of help</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">explaining how to do this could be helpful.<SPAN class="Apple-converted-space"> </SPAN>ie, which functions are</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">required for which features.</FONT></P> </BLOCKQUOTE></DIV><BR><DIV>I really do not want to edit your recipe when I download it. It loses all its plug-and-playness and would need to be re-hacked every time you update for something routine or important without changing the basic functionality of the application. Also, I could be using ALL your functions, but not every time a single form is used -- this one there, that one somewhere else. If I want to keep the recipe in tact, compartmentalizing it and only calling the needed functions is really the best way I can think to go about it. Yes, it's more files to keep track of, but it also helps you think about how you've organized your code.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Now, if you need help looking at your code from a new perspective, I suggest you ignore the 500 line barrier and document the code -- a lot. Then people can look at it, make suggestions to improve it, make suggestions as to how you could have it execute more smoothly, etc.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Crisses</DIV></BODY></HTML>