[pmwiki-users] update PTV value in a PHP function
Peter Bowers
pbowers at pobox.com
Thu Aug 7 13:15:30 CDT 2008
And for this reason cookbook/Toolbox exists.
Check out 2 related functions there:
(1) writeptv() does almost exactly hwat you are asking for (in
addition to allowing arrays of variablename/value so that you can
update n variables and not just a single one)
(2) ptv2text() deals only with the text, allowing you to determine how
you want to read the page and write the page.
Both of these also ask for a $ptvfmt which defaults to "hidden" but
can also be set to "text", "deflist", etc -- where possible I've tried
to follow fox's terminology and etc. as a type of defacto standard.
Obviously you are free to copy the code if you like, but the idea is
to install this as a development-tool recipe (it provides no markup or
anything -- just a few "library" functions for recipe authors) and
then call the functions from your code.
-Peter
On Thu, Aug 7, 2008 at 3:48 PM, Stéphane Heckel <hsteph at club-internet.fr> wrote:
> Greetings, ...
>
> I need your help as it is _really_ beyond my skills, ...:)
> I would like to update the PTV value of a page through a php function.
>
> - Input parameters are pagename, ptvname, ptvvalue
>
> - The function does ...
> * read the page (it must exists) and create and/or update the existing PTV
> value
> * write the page
>
> The skelton of this php looks like this, ... the missing part is the PTV
> update.
>
> Could someone switch the light on please ?
> Thanks
>
> SH
>
> ***********************************************************************
> function updatePTVpage($pagename, $ptvvalue) {
>
> if(!PageExists($pagename)) {
> return new xmlrpcresp(0, 101, "Page not found");
> }
> $Now=time();
> define('READPAGE_CURRENT', $Now+604800);
> $page = RetrieveAuthPage($pagename, "read", false, READPAGE_CURRENT);
>
> ############ UPDATE ptvname with ptvvalue - example of code ###############
> ############ $content = ????? #################"
>
> return BloggerXMLRPC::PostWikiPage($pagename, $content, $publish, true);
> return new xmlrpcresp($myStruct);
> }
>
>
>
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>
More information about the pmwiki-users
mailing list