Difference between revisions of "Core/getLanguages"

From PunchCMS
Jump to: navigation, search
(New page: __NOTOC__ ==== PCMS_Client->getLanguages() ==== === Overview === Get a collection of all active languages. === Arguments === None === Returns === If Languages are found this method returns...)
 
(Returns)
 
Line 6: Line 6:
 
None
 
None
 
=== Returns ===
 
=== Returns ===
If Languages are found this method returns a [[Collection|Collection]] object containing all active languages. Otherwise an empty collection. <br>
+
If Languages are found this method returns a [[Collection|Collection]] object containing all active languages. Otherwise an empty collection. That way you can test if you get a valid return using the [[Collection/count|count()]] method.
That way you can test if you get a valid return using the [[Collection/count|count()]] method.
+
 
 
=== Example ===
 
=== Example ===
 
<source lang="php">
 
<source lang="php">

Latest revision as of 22:29, 25 December 2008

PCMS_Client->getLanguages()

Overview

Get a collection of all active languages.

Arguments

None

Returns

If Languages are found this method returns a Collection object containing all active languages. Otherwise an empty collection. That way you can test if you get a valid return using the count() method.

Example

$objCms = PCMS_Client::getInstance();
 
// Get a collection of Languages.
$objLanguages = $objCms->getLanguages();
foreach ($objLanguages as $objLanguage) {
    // Loop through the collection.
}