API15:JHelp/createSiteList
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
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
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
libraries/joomla/language/help.php
Importing
jimport( 'joomla.language.help' );
Source Body
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
<CodeExamplesForm />
