Solved!
How embarrassing--boy was I overlooking the obvious. Set a location
from each controller respectively and then access it in the element
like so:
// @ app/views/elements/masthead.thtml
<div id="header">
<h1 style="display:none;">Graphic Manifesto</h1>
<a href="/"><img src="/img/logo.gif" /></a>
<ul class="textNavigation">
<?php
$media = $this->requestAction('media/index');
$count = 1;
foreach ($media as $medium):
?>
<li<?php if ($count == 1) { echo ' class="first"';}?>><?php
if ($location_main == $medium['Medium']['slug']) {
echo
$html->link($medium['Medium']['name'],'/projects/media/' .
$medium['Medium']['slug'], array('class' => 'active'));
} else {
echo
$html->link($medium['Medium']['name'],'/projects/media/' .
$medium['Medium']['slug']);
}
?></li>
<?php
$count++;
endforeach;
?>
<li><a href="/pages/contact_no_js.htm"
id="contactLink">Contact</a></
li>
</ul>
</div>
// @ app/conrollers/media_controller.php
function view($slug) {
if(!$slug) {
$this->Session->setFlash('Invalid slug for Medium.');
$this->redirect('/media/index');
}
$this->Medium->recursive = 1;
$medium = $this->Medium->findBySlug($slug);
$this->set('location_main', $medium['Medium']['slug']);
$this->set('medium', $medium);
}
// @ app/conrollers/projects_controller.php
function view($slug) {
if(!$slug) {
$this->Session->setFlash('Invalid id for Project.');
$this->redirect('/projects/index');
}
$project = $this->Project->findBySlug($slug);
$this->set('project', $project);
$this->set('location_main', $project['Medium']['slug']);
$this->set('subnav', $this->Project->Medium-
>findById($project['Project']['medium_id']));
$images = array();
foreach ( $project['Image'] as $image ) {
if ( $image['published'] ) {
array_push($images, $image);
}
}
$this->set('images', $images);
}
//
Hopefully someone else can get some mileage out of this
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---