[pmwiki-users] using PTVs from pagelists in skin scripts (or how to register a new PV)

a.sonderhoff at gassi-tv.de a.sonderhoff at gassi-tv.de
Sat May 12 01:11:23 CDT 2012


Peter, thx so much for your reply. I was suspecting that much. That’s why I tried to write some markup to actually register a real PV (with <{$var} priority), but I couldn’t get that to work beyond the scope of a single page.

As far as I can tell, the problem breaks down this single question: 
Why can a php script referenced in the skin’s .tmpl file access PTVs and PVs set by (:var: :) and (:var :) but not when those are within a pagelist? Is there a way to tell the script to run ‘>pagelist’ (after all pagelists have been processed)?

I will also look into triggering the script as a php markup script (<!--markup:(:somescript:)--> instead of <!--file:somescript.php-->). hopefully this workaround will solve the order issues by having PmWiki figure them out.

Josh


On May/11, 2012, at 2356 , Peter Bowers wrote:

>> On Fri, May 11, 2012 at 10:29 AM, <a.sonderhoff at gassi-tv.de> wrote:
>> Here is my problem. #1 and #2 are for further background only. I am basically trying to use PVs and PTVs of the newest page in a certain group when visiting another page in another group within a script referenced by the active skin’s .tmpl file by using a pagelist.
>> 
>> 1) I have a simple custom skin which loads a script into a div with <!--file:$SkinDir/somescript.php-->
>> 
>> 2) the somescript.php basically does this:
>> 
>> <?php if (!defined('PmWiki')) exit();
>> global $pagename;
>> $imageLink = PageVar($pagename,'$:image');
>> echo MarkupToHTML($pagename, "Attach:$imageLink");
>> 
>> 3) (:image: …:) is set on SomeGroup.SomePage
>> 
>> 4) I have a pagelist in SomeOtherGroup.SomeOtherPage which basically does this:
>> 
>> (:pagelist fmt=somePagelistFmt group=SomeGroup count=1 order=-ctime name=-*Recent*,-GroupAttributes:)
>> 
>> 5) #somePageListFmt is defined in LocalTemplates as
>> 
>> [[#somePageListFmt]]
>> (:template each:)
>> (:title {=$Title}:)
>> (:image: {=$:image}:)
>> ! {=$Title}
>> Attach:{=$:image}
>> [[#somePageListFmtend]]
>> 
>> 6) what happens on SomeOtherGroup.SomeOtherPage is, that {$Title} is set by the pagelist while {$:image} is not. both are displayed correctly in the further output of the pagelist template. this is driving me mad (already tried to circumvent this with a real PV, which failed due to my lack of understanding of PmWiki’s $FmtPV[] / setProperty()). any ideas on what I am doing wrong?
> 
> Ooh, that made my head hurt just trying to figure out where everything was going.  You've got so many things going on there which will require *very* complex  rule ordering and may be impossible.  I would strongly recommend simply writing a custom markup that does what you need in PHP rather than trying to get a pagelist to run based on certain variables which in turn sets other variables and creates attachment and image markup...  It may well be possible, but you're going to have to look at the order of the rules very closely -- I'm taking a guess that this is what is causing your solution to not work.  Assuming you can get it working I think it will be carefully "balanced" and every time you make a little change to your configuration (esp anything which affects the rules) you will "knock it off balance" again..
> 
> -Peter
> 




More information about the pmwiki-users mailing list