Question about JView and $this->items (J! 2.5). - Joomla! Forum - community, help and support
hi,
in developing mvc component tutorial helloworldviewhelloworlds extends jview class following.
everything clear excepting lines
as far understand $this->items means items either member of class helloworldviewhelloworlds or inhereted jview. however, cant see declaration of items in helloworldviewhelloworlds.
i had @ jview class couldnt find items declaration in class either.
so question items come from? (i c/c++ programmer, maybe missing php programming).
in developing mvc component tutorial helloworldviewhelloworlds extends jview class following.
code: select all
<?php
// no direct access file
defined('_jexec') or die;
jimport('joomla.application.component.view');
class helloworldviewhelloworlds extends jview
{
function display($tpl = null)
{
// data model
$items = $this->get('items');
$pagination = $this->get('pagination');
// assign data view
$this->items = $items;
$this->pagination = $pagination;
// display template
parent::display($tpl);
}
}
?>everything clear excepting lines
code: select all
// assign data view
$this->items = $items;
$this->pagination = $pagination;as far understand $this->items means items either member of class helloworldviewhelloworlds or inhereted jview. however, cant see declaration of items in helloworldviewhelloworlds.
i had @ jview class couldnt find items declaration in class either.
so question items come from? (i c/c++ programmer, maybe missing php programming).
i'm no expert here learned myself.
this data assignment. doing here making items available in view's layout (in other words tmpl/default.php or whatever called it).
this:
is same writing:
what's happening here jview's display method "include" (php include) layout, therefore $this-><whatever> available use in layout code
this data assignment. doing here making items available in view's layout (in other words tmpl/default.php or whatever called it).
this:
code: select all
$this->items = $items;is same writing:
code: select all
$this->assignref( 'items', $items );what's happening here jview's display method "include" (php include) layout, therefore $this-><whatever> available use in layout code
Comments
Post a Comment