Custom Component - Image Gallery/Portfolio - MVC newbie - Joomla! Forum - community, help and support
hi all,
i'm not new joomla or php first time i've ever created own component mvc pattern. give myself head start used excellent online joomla component creator create component "scaffolding".
the project i'm creating basic image gallery/portfolio organised categories , subcategories. created table categories , table subcategories below:


then created table house management of images/thumbnails , store captions , titles etc... used foreign keys categories/subcategories respective tables:

now, installed package , populated database dummy copy , images , have managed view displaying of records. used foreach ($this->items) loop , real confidence boost can't work out best way of creating menu can select displayed user. i've done simple layout illustrate how component work menu of categories , subcategories on left:

do have make seperate views each of subcategories , create menu in joomla menu manager? i'd prefer not doesn't seem expandable? i.e if creates new subcategory i'd have write new view. same applies creating model query each subcategory, have create query every new subcategory.
i know i'm missing trick here, don't know proper way of going this.
i tried adding function in view.html.php file takes $this-items , builds menu published items:
i created function takes $this-items subcategory , published state , returns array of items:
i writing out menu foreach loop , using jrequest::getvar() pass subcategory populate_subcategories() function.
i thought working fine (i had sef links working router.php!) added more items pagination limit test pagination , realised $this->items paginated results!
now i'm stuck. suspect logic of making menu , filtering/displaying items fatally flawed - i've been going wrong way, putting functions in wrong place , screwing real noob.
if can me i'd appreciate - i'm not sure of efficient way go , it's annoying because feel i'm close comprehending mvc pattern stuff!
all best
mb
i'm not new joomla or php first time i've ever created own component mvc pattern. give myself head start used excellent online joomla component creator create component "scaffolding".
the project i'm creating basic image gallery/portfolio organised categories , subcategories. created table categories , table subcategories below:


then created table house management of images/thumbnails , store captions , titles etc... used foreign keys categories/subcategories respective tables:

now, installed package , populated database dummy copy , images , have managed view displaying of records. used foreach ($this->items) loop , real confidence boost can't work out best way of creating menu can select displayed user. i've done simple layout illustrate how component work menu of categories , subcategories on left:

do have make seperate views each of subcategories , create menu in joomla menu manager? i'd prefer not doesn't seem expandable? i.e if creates new subcategory i'd have write new view. same applies creating model query each subcategory, have create query every new subcategory.
i know i'm missing trick here, don't know proper way of going this.
i tried adding function in view.html.php file takes $this-items , builds menu published items:
i created function takes $this-items subcategory , published state , returns array of items:
code: select all
function populate_subcategories($itemsin,$subcategoryin,$publishedbool)
{
foreach ($itemsin $thiskey => $item)
{
if ($item->state == $publishedbool)
{
if (strtolower(str_replace( " ", "-", $item->subcategories_subcategoryname)) == $subcategoryin)
{
$todisplay[$thiskey]['state'] = $item->state;
$todisplay[$thiskey]['artworkname'] = $item->artworkname;
$todisplay[$thiskey]['artworkdescription'] = $item->description;
$todisplay[$thiskey]['image'] = $item->image;
$todisplay[$thiskey]['thumbnail'] = $item->thumbnail;
}
}
}
return $todisplay;
}
i writing out menu foreach loop , using jrequest::getvar() pass subcategory populate_subcategories() function.
i thought working fine (i had sef links working router.php!) added more items pagination limit test pagination , realised $this->items paginated results!
now i'm stuck. suspect logic of making menu , filtering/displaying items fatally flawed - i've been going wrong way, putting functions in wrong place , screwing real noob.
if can me i'd appreciate - i'm not sure of efficient way go , it's annoying because feel i'm close comprehending mvc pattern stuff!
all best
mb
bumpety bump? 
really need hand logic on - have explained properly?
mb
really need hand logic on - have explained properly?
mb
Comments
Post a Comment