API16

JView/getName

From Joomla! Documentation

< API16:JView

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]

Method to get the view name



Syntax[edit]

getName()


Returns[edit]

string The name of the model

Defined in[edit]

libraries/joomla/application/component/view.php

Importing[edit]

jimport( 'joomla.application.component.view' );

Source Body[edit]

function getName()
{
        $name = $this->_name;

        if (empty($name))
        {
                $r = null;
                if (!preg_match('/View((view)*(.*(view)?.*))$/i', get_class($this), $r)) {
                        JError::raiseError (500, "JView::getName() : Cannot get or parse class name.");
                }
                if (strpos($r[3], "view"))
                {
                        JError::raiseWarning('SOME_ERROR_CODE',"JView::getName() : Your classname contains the substring 'view'. ".
                                                                                "This causes problems when extracting the classname from the name of your objects view. " .
                                                                                "Avoid Object names with the substring 'view'.");
                }
                $name = strtolower($r[3]);
        }

        return $name;
}



Examples[edit]

Code Examples[edit]