So I have an admin panel and now I am trying to make a public page that will show “categories” and comes with a filter that shows the “products” under them. This is in my CategoriesController
public function main(){
$this->set('categories',$this->Category->find('all'));
And this is my main.ctp in the view
<table>
<h1>Categories</h1>
<tr>
<th>name</th><th>Products</th>
</tr>
<? foreach($Categories as $row): ?>
<tr><td>
<?=$row['Category']['name']?>
</td><td>
<a href="../todo/products/filter/<?=$row['Category']['id']?>">Products</a>
</td></tr>
<? endforeach; ?>
<a href="http://webdesign4.georgianc.on.ca/~100141468/comp2084/todo/Categories/add/"> Add a Category</a>
Does anyone see what I am doing wrong here? I keep getting an error on the foreach
try using the variables in the same case sensitive manner you declare them in.
i will give you a hint: Categories !== categories