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

Peter Bowers pbowers at pobox.com
Fri May 11 16:56:29 CDT 2012

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..

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20120511/51515eb2/attachment.html>

More information about the pmwiki-users mailing list