Actions

API15

JView/getName

From Joomla! Documentation

< API15:JView
Revision as of 17:10, 22 March 2010 by Doxiki (Talk | contribs)

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Method to get the view name

[Edit Descripton]

Description:JView/getName

Syntax

getName()


Returns

string The name of the model

Defined in

libraries/joomla/application/component/view.php

Importing

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

Source Body

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;
}

[Edit See Also] SeeAlso:JView/getName

Examples

<CodeExamplesForm />