tags.select

Select all tags from pages from given site or page or category
argument keys:

  • site: site to get pages to get tags from, e.g. "my-site"
  • categories (optional): list of names of categories to get pages to get tags from
  • pages (optional): list of full names of pages to get tages from - max 10 of them

returns: list of tags

This tags.select 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. Change the $tcategories array to list the categories to get pages from. Change the $tpages array to contain the pages to get tags from, this can be left blank. 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
//common example start
    $siteobj = new WikidotSite($SiteName, $Client);
    $returnarray = array();
 
    echo "<h3>tags.select example</h3></br><hr>";
    $tcriteria = array();
//change $tcategories array to list categories to get tags
    $tcategories = array("CATEGORY1", "CATEGORY2", etc...);
//change $tpages array to list specific pages to get tags
//$tpages can be left blank to list all page tags in the categories
    $tpages = array(""); //max of ten
    $tcriteria['categories'] = $tcategories;
    $tcriteria['pages'] = $tpages;
    $siteobj->php_tags_select($tcriteria, $returnarray);
    foreach($returnarray as $key=>$data){
        echo $key.": ".$data."</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