API16

JInstallerTemplate/discover

From Joomla! Documentation

< API16:JInstallerTemplate
Revision as of 22:02, 13 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)

The "API16" 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]

Discover existing but uninstalled templates Array JExtensionTable list


[<! removed edit link to red link >]

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

Syntax[edit]

discover()


Returns[edit]

Array JExtensionTable list

Defined in[edit]

libraries/joomla/installer/adapters/template.php

Importing[edit]

jimport( 'joomla.installer.adapters.template' );

Source Body[edit]

function discover()
{
        $results = Array();
        $site_list = JFolder::folders(JPATH_SITE.DS.'templates');
        $admin_list = JFolder::folders(JPATH_ADMINISTRATOR.DS.'templates');
        $site_info = JApplicationHelper::getClientInfo('site', true);
        $admin_info = JApplicationHelper::getClientInfo('administrator', true);

        foreach ($site_list as $template)
        {
                if ($template == 'system') {
                        continue;
                        // ignore special system template
                }
                $extension = &JTable::getInstance('extension');
                $extension->set('type', 'template');
                $extension->set('client_id', $site_info->id);
                $extension->set('element', $template);
                $extension->set('name', $template);
                $extension->set('state', -1);
                $results[] = $extension;
        }
        foreach ($admin_list as $template)
        {
                if ($template == 'system') {
                        continue;
                        // ignore special system template
                }
                $extension = &JTable::getInstance('extension');
                $extension->set('type', 'template');
                $extension->set('client_id', $admin_info->id);
                $extension->set('element', $template);
                $extension->set('name', $template);
                $extension->set('state', -1);
                $results[] = $extension;
        }
        return $results;
}

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

Examples[edit]

<CodeExamplesForm />