[pmwiki-users] some variable issues

V.Krishn mistyfire at autograf.pl
Fri Mar 25 15:31:06 CST 2005


On Saturday 26 March 2005 01:48, you wrote:
> On Sat, Mar 26, 2005 at 02:06:05AM +0530, V.Krishn wrote:
> > Ok, I was trying to create a cookbook receipe:
> > Here are the files that are to be packed:
> > receipe.php
> > receipe.css
> > receipe1.gif
> > receipe.gif
> >
> > In .php file I use $HTMLHeaderFmt[] to load the .css file.
> >
> > What what would be the best method for packing.
>
> I would say that recipe.php should go in cookbook/ , and the
> rest of the files should go in pub/recipe/ (perhaps recipe.css
> should go into pub/css/ , but there's not much of a standard there).
>
> Alternately, the entire package including the .php file could go
> into pub/recipe/, as long as any .php files are protected or safe
> from direct execution by a browser.
>
> In general, any files that need to be accessible to a browser (such
> a .gif images and .css files) belong in pub/ somewhere.
>
> > Now the moot question is "Will this receipe work from both FARM as
> > well as any FIELD"?
>
> It depends -- the interaction of cookbook recipes and farms isn't
> entirely defined.  The question is one of whether one thinks that
> cookbook recipes can be installed per-field or whether they should
> always go into the farm.  (PmWiki itself is purposefully silent on
> this issue.)
>
> In general, recipes that need to reference public files should probably
> use $PubDirUrl, but also provide an option that allows the admin to
> select a different location (e.g., $FarmPubDirUrl) if $PubDirUrl isn't
> correct.  Or, perhaps we can provide a variable or method whereby
> cookbook recipes can determine if they're farm-based or field-based
Yes please :-) if its simple and a generic function.
> and select the correct pub/ location accordingly.
~phew~
And as for HISTORICAL purpose here is what i did:

// Change these values accordingly.
$InstallDir = 'cookbook';
$thisDir = 'receipe';

$InstallDirFmt = '/' . $InstallDir . '/' . $thisDir;
$thisScriptD = dirname(__FILE__);
/* Use this if installing in individual fields */
//$thisScriptDUrl = preg_replace('#/[^/]*$#',$InstallDirFmt,$ScriptUrl,1);
/* Use this if installing at farms */
$thisScriptDUrl = preg_replace('#/[^/]*$#',$InstallDirFmt,$FarmPubDirUrl,1);

global $HTMLHeaderFmt;
$HTMLHeaderFmt[] = "\n<link rel='stylesheet' type='text/css' 
href='$thisScriptDUrl/receipe.css' />\n";
>
> Pm
Thanks



More information about the pmwiki-users mailing list