[pmwiki-users] how to access configuration variables from skin scripts

a.sonderhoff at gassi-tv.de a.sonderhoff at gassi-tv.de
Sun Mar 11 04:41:01 CDT 2012


Dear Petko

Apologies for my delayed reply and many thanks for your answers. Your hint with the globals declaration works great (I did try to access the globals with the globals array only and not by declaring them global in my script, which was my error).

> $HandleBrowseFmt = array(&$PageStartFmt, &$PageRedirectFmt, &$PageEndFmt);
This works as well, though not exactly like I was hoping to use it. I was hoping to use a directive like this in the skin template’s php file (where I have all the skin related conditional stuff). 

My template basically has a primary content div which shows an image and some text extracted from PTVs and a sidebar content div into which the sidebar (basically a pagelist with pagination) is AJAXed:
› The sidebar has its own tmpl file which will either use <!--PageText--> or <!--wiki:$Group.SideBar Site.SideBar--> directive to render the contents
› The primary content’s tmpl does not use the <!--PageText--> directive at all
› all actions other than browse obviously use a tmpl which needs <!--PageText-->

So I can either 
A) conditionally implement ‘$HandleBrowseFmt = array(&$PageStartFmt, &$PageRedirectFmt, &$PageEndFmt);’ in the config.php to show up only on action == browse and use <!--wiki:$Group.SideBar Site.SideBar--> directive to circumvent the <!--PageText--> directive being neutralized in the config.php or
B) find some way to do place the conditional logic in the template’s .php

B sounds like the cleaner solution to me, but I am lacking knowledge of PmWiki’s processing chain. In which order are config.php and skin.php(1) evaluated? E. g. can I define a global variable in skin.php to conditionally use the var in config.php? Or are there other ways to achieve this?

Thanks a lot
Josh



(1) skin.php in this context is a placeholder for the skin templates primary php file



-- 
GASSI TV® brand & marketing

office +49 2238 4629519
mobile +49 1511 5794189
fax    +49 2238 963023
email  <a.sonderhoff at gassi-tv.de>
web    <http://gassi-tv.de>

moving pixies GmbH
Aurikelweg 22
DE-50259 Pulheim
Geschäftsführer: Daniel Sonderhoff
Amtsgericht Köln, HRB 74273


Save the world — Don't print this e-mail!


On Feb/26, 2012, at 1900 , pmwiki-users-request at pmichaud.com wrote:

> Date: Sun, 26 Feb 2012 12:18:28 +0100
> From: 5ko at 5ko.fr
> To: pmwiki-users at pmichaud.com
> Subject: Re: [pmwiki-users] how to access configuration variables from
> 	skin scripts
> Message-ID: <cone.1330255108.147913.13221.1000 at pc4>
> Content-Type: text/plain; format=flowed; delsp=yes; charset="UTF-8"
> 
> a.sonderhoff at gassi-tv.de writes:
>> 1) Basically I have a lot of <!--file:somephp.php--> in my tmpl to fire the  
>> scripts that merge the page variables and PTVs with the html/css. The  
>> functions described in the link given above work just fine, configuration  
>> variables (such as $FarmD, $SkinDirUrl, etc.) however are not accessible.
> 
> Add at the beginning of your scripts
> 
>  global $FarmD, $SkinDirUrl;
> 
>> a limitation as I do not need the output produced by <!--PageText--> in all  
>> of the tmpl files ...   Omitting the  
>> PageText special directive results in PmWiki outsmarting me and inserting  
>> the PageText content just before the </body> tag. Is there any way to force  
>> PmWiki to not output the PageText in certain tmpl?s?
> 
> You can add this in config.php - possibly conditionnally :
> 
>  $HandleBrowseFmt = array(&$PageStartFmt, &$PageRedirectFmt, &$PageEndFmt);
> 
> Petko




More information about the pmwiki-users mailing list