On 9/17/06, <b class="gmail_sendername">Patrick R. Michaud</b> &lt;<a href="mailto:pmichaud@pobox.com">pmichaud@pobox.com</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
[Does anyone besides me think &quot;Snakes on a Plane&quot; whenever seeing<br>the subject &quot;SpellChecker on a Farm&quot; over and over again?&nbsp;&nbsp;;-) ]<br><br>&gt; Pico wrote:<br>&gt; : JB wrote:<br>&gt; : &gt; Pico wrote:
<br>&gt; : &gt; : I revised your edit to the documentation because there was no need<br>&gt; : &gt; : to provide different sets of include lines for farms and non-farms; all<br>&gt; : &gt; : installs can use the same line:
<br>&gt; : &gt; : include_once(&quot;$FarmD/cookbook/spellchecker.php&quot;);<br>&gt; : &gt;<br>&gt; : &gt; I do not think that is right.&nbsp;&nbsp;Sometimes a local wiki which uses farm<br>&gt; : &gt; recipes has one recipe that only it uses.
<br>&gt; :<br>&gt; : I don't agree that this (and, for that matter, every other recipe)<br>&gt; : should have two different installation instructions for farm and<br>&gt; : non-farm installs just because someone with a farm might want to
<br>&gt; : physically place the recipe in a field, instead of simply invoking it<br>&gt; : from the local field config.<br>&gt; : Does anyone think that JB has the better approach here and, if so,<br>&gt; : should it be adopted for all recipes?
<br><br>Here's what I think:<br><br>First, I absolutely do not want to see two different farm/non-farm<br>installation instructions in every recipe.<br><br>Almost by definition, administering a wikifarm implies that the farm
<br>administrator be (or become) a bit more familiar with the way that<br>filesystem paths and urls work in their particular farm environment.<br>So, the standard instructions for a basic recipe ought to be for the<br>simple non-farm case, and farm administrators should be making the
<br>adjustment to use include_once(&quot;$FarmD/...&quot;) as appropriate.&nbsp;&nbsp;This<br>is consistent with the way PmWiki's documentation is set up.<br><br>Of course, if the recipe is primarily intended only for farm environments,
<br>then it's okay to use $FarmD/... for everything.<br><br>On Sun, Sep 17, 2006 at 11:42:03AM -0400, Scott Connard wrote:<br>&gt; What concerns me a little more is the need to edit the source to change<br>&gt; &quot;$PubDirUrl&quot; to &quot;$FarmPubDirUrl&quot; for the SpellChecker script.&nbsp;&nbsp;Is this
<br>&gt; required for many other cookbook scripts?&nbsp;&nbsp;Is there a way to engineer<br>&gt; a common solution for this problem?<br><br>It doesn't happen often, as can be seen from the fact that there aren't<br>many messages about such on the mailing list.
<br><br>Yes, there are ways to for recipes to make it easier on wikifarms.<br><br>Option 1:&nbsp;&nbsp;Use configuration variables<br>--------------------------------------<br>One easy way to deal with this is for the recipe itself to have its own
<br>configuration variable as opposed to always using $PubDirUrl or<br>$FarmPubDirUrl.&nbsp;&nbsp;Note that this is what PmWiki tends to do for its<br>scripts and modules.<br><br>In the case of the spellchecker.php recipe, it'd be a simple matter
<br>for it to do:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;SDV($SpellerUrl, &quot;$PubDirUrl/speller&quot;);<br><br>and replace all instances of &quot;$PubDirUrl/speller&quot; or<br>&quot;$FarmPubDirUrl/speller&quot; in the recipe with &quot;$SpellerUrl&quot;.
<br><br>Someone using spellcheck.php in a farm then sets a custom value<br>for $SpellerUrl prior to including the recipe:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;$SpellerUrl = &quot;$FarmPubDirUrl/speller&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;include_once(&quot;$FarmD/cookbook/spellchecker.php&quot;);
<br><br><br>Option 2: Have the recipe detect when it's in a farm context<br>------------------------------------------------------------<br>I haven't ever tried this, but one possibility might to have a recipe<br>detect when it's being called in a farm context, by comparing its
<br>filename to the $FarmD variable.&nbsp;&nbsp;Thus, spellchecker.php might do:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;if (strncmp(__FILE__, $FarmD, strlen($FarmD)) == 0)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SDV($SpellerUrl, &quot;$FarmPubDirUrl/speller&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SDV($SpellerUrl, &quot;$PubDirUrl/speller&quot;);
<br><br>Thus, if a script does include_once(&quot;$FarmD/cookbook/spellchecker.php&quot;) the<br>spellchecker.php script will detect that it's been called with the $FarmD<br>prefix and use the $FarmPubDirUrl value, otherwise it uses $PubDirUrl.
<br>Note that in either case I'm initializing the configuration variable<br>using SDV so that the administrator can override the default.<br><br><br>One thing I do not want to see happen is that this sort of<br>thing become required for recipes -- it can be listed as a guideline,
<br>but I don't want to be rejecting or criticizing recipe submissions<br>simply because the author didn't consider wikifarms.<br><br>&gt; Should ALL code referencing $PubDirUrl look in $PubDirUrl first and<br>&gt; then failing that look in $FarmPubDirUrl (if it is different than $PubDirUrl)?
<br><br>Here lies part of the confusion between files and urls -- how exactly<br>does a script look in a url (such as $PubDirUrl)?<br><br>Pm<br><br><br>P.S.:&nbsp;&nbsp;I think the spellchecker recipe ought to standardize on either
<br>&quot;speller&quot; or &quot;spellchecker&quot; for its names, and not use both.<br>I'll probably rewrite the recipe to do that, and to incorporate the<br>$FarmD detection as given above.</blockquote><div><br>It really needs to incorporate a php-only spell-checker, but there
wasn't a suitable one available at the time I originally
'ported/contributed/proposed' this recipe, however one of the links on
the recipe pages now lists 'pspellX' as a possible fall-back position,
it would be nice if the script is being re-visted to bring that
on-board ? <br>
<br>&nbsp;- Ciaran [too tied up in a .Net + Java world to fix his old PHP/PmWiki scripts currently :( ]<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
_______________________________________________<br>pmwiki-users mailing list<br><a href="mailto:pmwiki-users@pmichaud.com">pmwiki-users@pmichaud.com</a><br><a href="http://www.pmichaud.com/mailman/listinfo/pmwiki-users">http://www.pmichaud.com/mailman/listinfo/pmwiki-users
</a><br></blockquote></div><br><br clear="all"><br>-- <br>- Ciaran<br>(I now have far too many G-Mail invites available, anyone who wants one, gets one)