Her er du:

Indhold

Codesnippets for ZOO CKK Development

Collection of random usefull snippets used in Yootheme ZOO CCK



Access the value of a element

General information

$myelement = $item->getElement('ccd051d9-b21d-49a3-8a7e-c3421b2e140b');
echo $myelement->get('value');



ZOO instance

General information

$zoo = App::getInstance('zoo');
$zoo->zoo->getApplication();

//Get the active application
$app = $this->app->zoo->getApplication();
//Get the categories of this app
$categories = $app->getCategories();



Data Object

Object with table data based on paramaters

$ID = itemID
$Tablename = The table name

$object = $this->app->table->$Tablename->get($id)
Creates dataobject with the data available from $tablename where $id is matched.

In SQL it would look like this:
SQL=SELECT * FROM crea_zoo_application WHERE id = $id



Translate Alias to ID

Search alias in databasetable and get the id

$Tablename = "The table name" (ex. application)
$theIDofAlias = $this->app->alias->$name->translateAliasToID('theNameOfTheAlias');



ZOO Element Parameters

How to get values from the element configuration
(the parameters set under; “Edit Element”)

$this->config->get('NAME_OF_PARAMETER');
The paramenter is stored in the CONFIG-file
path: /public_html/media/zoo/applications/download/types



JRequest in ZOO

Fetch data from POST OR GET

Example Fetch elements from the URL
You have this URL: http://www.crea-aalborg.dk/administrator/index.php?option=com_zoo&controller=manager&task=types&group=download

You would like to get the value of URL-element: "group"
$group = $zoo->request->getString('controller');
Then $group will be: "download"



Get all application instances or all application instances in a certain group

Helper function: getApplications($group)

$this->app->application->getApplications();
Returns array with all application instances

$this->app->application->getApplications('download');
Returns array with all application instances in the group "download"



Oprettet af: Casper Nøhr Hansen | I kategori: Joomla! | Oprettet: Tuesday, 21 October 2014 | Opdateret: Wednesday, 15 July 2015

Comments (0)

Leave a comment

You are commenting as guest.