API15

Difference between revisions of "JHelp/createSiteList"

From Joomla! Documentation

< API15:JHelp
(New page: ===Description=== Builds a list of the help sites which can be used in a select option <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JHelp/createSi...)
 
m (removing red link to edit, no existant pages)
Line 3: Line 3:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JHelp/createSiteList|Edit Descripton]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
  
{{Description:JHelp/createSiteList}}
+
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 76: Line 76:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JHelp/createSiteList|Edit See Also]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
{{SeeAlso:JHelp/createSiteList}}
+
<! removed transcluded page call, red link never existed >
  
 
===Examples===
 
===Examples===
Line 91: Line 91:
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API15]]

Revision as of 12:21, 12 May 2013

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Builds a list of the help sites which can be used in a select option

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax[edit]

createSiteList($pathToXml, $selected=null)
Parameter Name Default Value Description
$pathToXml Path to an xml file
$selected null Language tag to select (if exists)

Defined in[edit]

libraries/joomla/language/help.php

Importing[edit]

jimport( 'joomla.language.help' );

Source Body[edit]

function createSiteList($pathToXml, $selected = null)
{
        $list   = array ();
        $xml    =& JFactory::getXMLParser('Simple');
        $data   = null;
        if( !empty( $pathToXml ) ) {
                $data = file_get_contents($pathToXml);
        }

        if(empty($data))
        {
                $option['text'] = 'English (GB) help.joomla.org';
                $option['value'] = 'http://help.joomla.org';
                $list[] = $option;
        }
        else
        {
                if($xml->loadString($data))
                {
                        // Are there any languages??
                        $elmSites = & $xml->document->sites[0];

                        if (is_object($elmSites)) {

                                $option = array ();
                                $sites = $elmSites->children();
                                foreach ($sites as $site)
                                {
                                        $text                           = $site->data();
                                        $url                            = $site->attributes('url');
                                        $option['text']         = $text;
                                        $option['value']        = $url;
                                        $list[]                         = $option;
                                }
                        }
                }
        }

        return $list;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples[edit]

<CodeExamplesForm />