Het idee is om drie ajax links te hebben. Deze drie ajax links linken
naar 1 specifieke element (in dit geval een formulier). Ook is er 1
ajax div waarin de elementen moeten worden gerenderd. Als je op het
eerste linkje klikt, in dit geval: google. Laad hij perfect het
element dat daarbij hoort. Klik je op het tweede linkje, opent hij ook
het element dat daarbij hoort namelijk ex maar ook het element google.
En bij het derde linkje percies hetzelfde.
Hij zou dus het divje leeg moeten gooien en alleen het gevraagde
element moeten laten zien, en niet alles onder elkaar zetten.
Weet hier iemand een oplossing voor?
De Codes:
Controller:
function view($id) {
// content could come from a database, xml, etc.
$content = array (
array($this->render(null, 'ajax', '/elements/
ga')),
array($this->render(null, 'ajax', '/elements/
ex')),
array($this->render(null, 'ajax', '/elements/
both')));
$this->set('google', $content[$id][0]);
// use ajax layout
$this->render('/pages/form', 'ajax');
}
View code:
echo $ajax->link( 'Google', array( 'controller' => 'analytics',
'action' => 'view', 0 ), array( 'update' => 'dynamic1'));
echo ' | ';
echo $ajax->link( 'Exact', array( 'controller' => 'analytics',
'action' => 'view', 1 ), array( 'update' => 'dynamic1', 'loading' =>
'Effect.BlindDownUp(\'dynamic1\')'));
echo ' | ';
echo $ajax->link( 'Beide', array( 'controller' => 'analytics',
'action' => 'view', 2 ), array( 'update' => 'dynamic1', 'loading' =>
'Effect.BlindDown(\'dynamic1\')' ));
echo $ajax->div('dynamic1'); echo $google; echo $ajax-
>divEnd('dynamic1');
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" 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