JHelp/createSiteList: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
| Line 68: | Line 68: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=createSiteList | category=createSiteList | ||
category=JHelp | category=JHelp | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 01:44, 25 March 2017
Description
Builds a list of the help sites which can be used in a select option
<! removed transcluded page call, red link never existed >
Syntax
static 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
static function createSiteList($pathToXml, $selected = null)
{
$list = array ();
$data = null;
$xml = false;
if (!empty($pathToXml)) {
$xml = JFactory::getXML($pathToXml);
}
if( ! $xml)
{
$option['text'] = 'English (GB) help.joomla.org';
$option['value'] = 'http://help.joomla.org';
$list[] = $option;
}
else
{
$option = array ();
foreach ($xml->sites->site as $site)
{
$option['text'] = (string)$site;
$option['value'] = (string)$site->attributes()->url;
$list[] = $option;
}
}
return $list;
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples