[eluser]WanWizard[/eluser]
I hope I don't offend you by replying in public, but I think others can learn from this too.
Apart from the issue at hand, one tip up front: do NOT use CAPITALS in your file or directory names. You must be using Windows to develop.
It took me 15 minutes to figure out why I was getting 404 errors, which was because of your modules starting with a capital letter.
Not done, and a disaster waiting to happen if you have to move to a hoster that runs on Linux or Unix.
Tip number two: always read the documentation before you start using something. In this case, datamapper creates a production cache as soon as you define a location in the config file. The cache contains information about your tables and your models. Once the cache exists, the model itself will no longer be used. Always disable the production cache while developing.
Final tip: see tip two. In this case, try to understand how things work before you start to use them, otherwise the strangest things happen.
Your code:
Code:
$portal = new portal(2);
$data['categories'] = $portal->category->get();
$page = new page();
$data['pages'] = $page->get();
You're dealing with objects here, so you don't have to assign them to variables, that will only create copies. Also, if you need categories and pages belonging to a portal ID, retrieve them from the portal object.
Code:
// create the portal object
$data['portal'] = new portal(2);
// fetch the categories
$data['portal']->category->get();
// fetch the pages
$data['portal']->page->get();
Remember, you have an object hierarchy loaded ( portal->category and portal->page ).
Then, in your view you do:
Code:
<?php foreach($categories AS $cat):?>
<li> » <?=anchor($cat->category->slug.'/Services/'.$cat->slug,$cat->title);?></li>
<?php endforeach;?>
<?php foreach($pages AS $pg):?>
<li> » <?=anchor($pg->page->slug.'/Documentation/'.$pg->slug,$pg->title);?></li>
<?php endforeach;?>
You should do (using the code above):
Code:
<?php foreach($portal->category AS $cat):?>
<li> » <?=anchor($cat->slug.'/Services/'.$portal->slug,$portal->title);?></li>
<?php endforeach;?>
<?php foreach($portal->page AS $pg):?>
<li> » <?=anchor($pg->slug.'/Documentation/'.$portal->slug,$portal->title);?></li>
<?php endforeach;?>
Hope this helps you get going...