API15

JApplication/getItemid: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Deprecated, use ContentHelper::getItemid instead. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JApplication/getItemid|Edit Descr...
 
m removing red link to edit, no existant pages
Line 3: Line 3:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JApplication/getItemid|Edit Descripton]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>


{{Description:JApplication/getItemid}}
<! removed transcluded page call, red link never existed >


===Syntax===
===Syntax===
Line 51: Line 51:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JApplication/getItemid|Edit See Also]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>
{{SeeAlso:JApplication/getItemid}}
<! removed transcluded page call, red link never existed >


===Examples===
===Examples===
Line 66: Line 66:
  format= ,,,
  format= ,,,
</dpl>
</dpl>
[[Category:Archived pages API15]]

Revision as of 13:33, 12 May 2013

Description

Deprecated, use ContentHelper::getItemid instead.

[<! removed edit link to red link >]

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

Syntax

getItemid($id)
Parameter Name Default Value Description
$id

Defined in

libraries/joomla/application/application.php

Importing

jimport( 'joomla.application.application' );

Source Body

function getItemid( $id )
{
        require_once JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php';

        // Load the article data to know what section/category it is in.
        $article =& JTable::getInstance('content');
        $article->load($id);

        $needles = array(
                'article'  => (int) $id,
                'category' => (int) $article->catid,
                'section'  => (int) $article->sectionid,
        );

        $item   = ContentHelperRoute::_findItem($needles);
        $return = is_object($item) ? $item->id : null;

        return $return;
}

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

Examples

<CodeExamplesForm />