pages.get_meta

Get a bunch of pages and returns (some of) their meta data
argument keys:

  • site: site to list pages from, eg. "my-site"
  • pages: list of page full names to list (maximum 10 pages)

returns: dictionary of pages. For each page there will be item in the dictionary with page name as key and dictionary of the following page properties as value:

  • fullname
  • created_at
  • created_by
  • updated_at
  • updated_by
  • title
  • parent_fullname
  • tags: list of all tags (including those starting with underscore)
  • rating
  • revisions
  • [PLANNED] comments: number of comments
  • [PLANNED] files: number of files attached to the page
  • [PLANNED] children: number of children pages

This pages.get_meta demo uses the sample code below. Create a separate file in your hosted site. Change the path to the wikidot_class.inc and xmlrpc.inc files. Add files to get in the $Files array. Replace the all caps USERNAME, API KEY, and SITENAME with values specific to you and your site.


Sample Code

<?php
//set globals before includes
    $newdebuglevel = 0;    
 
//add includes
//change path to your server location
    include("../classes/wikidot_class.inc");
 
//set startup parameters for xmlrpc
//change path to your server location
    require_once("../classes/xmlrpc.inc");
    $GLOBALS ['xmlrpc_null_extension' ] = true;
    $ServerPath = "xml-rpc-api.php";
    $ServerHostName = "www.wikidot.com";
    $ServerPort = "";
 
//create a client for your site
 
    $Client = new xmlrpc_client($ServerPath,$ServerHostName,$ServerPort);
    $Client->setCredentials("USERNAME","API KEY");
    $Client->setDebug($newdebuglevel);
    $Client->setSSLVerifyPeer(false);
    $Client->setSSLVerifyHost(false);
    $Client->return_type = "phpvals"; //forces return of page.get_one as php values
    $SiteName = "SITENAME";
 
////////////test code
////////////code doesn't include error checking
    $metaobj = new WikidotMeta($SiteName, $Client);
    $returnarray = array();
    echo "<h3>pages.get_meta example</h3></br><hr>";
    $Files = array("CATEGORY:FILE1", "CATEGORY:FILE2", "CATEGORY:FILE3", "CATEGORY:FILE4");
 
    $metaobj->php_pages_get_meta($Files, $returnarray);
    foreach($returnarray as $filear){
        foreach($filear as $key=>$data){
            if($key == "tags"){
                foreach($data as $tag) echo $key.":tag=> ".$tag."</br>";}
            else echo $key.": ".$data."</br>";}
        echo "</br><hr></br>";}
 
?>

Download Code File

Live demo

Uses above code in an Iframe from a PHP host.


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License