Skip to content

Instantly share code, notes, and snippets.

@VaclavSir
Created July 28, 2012 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VaclavSir/3193886 to your computer and use it in GitHub Desktop.
Save VaclavSir/3193886 to your computer and use it in GitHub Desktop.
{#content}
<div n:snippet="a">
<a class="ajax" n:href="a!">handleA</a>
{$a}
</div>
<div n:snippet="b">
<a class="ajax" n:href="b!">handleB</a>
{$b}
</div>
<div n:snippet="c">
<a class="ajax" n:href="c!">handleC</a>
{$c}
</div>
{/#}
{#head}
<script type="text/javascript" src="{$basePath}/nette.ajax.js/nette.ajax.js"></script>
<script type="text/javascript" src="{$basePath}/nette.ajax.js/example.js"></script>
<script type="text/javascript" src="{$basePath}/nette.ajax.js/extensions/spinner.ajax.js"></script>
{/#}
<?php
/**
* Homepage presenter.
*/
class HomepagePresenter extends BasePresenter
{
private $a, $b, $c;
public function renderDefault()
{
$this->template->a = $this->a;
$this->template->b = $this->b;
$this->template->c = $this->c;
}
public function handleA()
{
sleep(2);
$this->a = 'handleA';
$this->invalidateControl('a');
}
public function handleB()
{
sleep(2);
$this->b = 'handleB';
$this->invalidateControl('b');
}
public function handleC()
{
sleep(2);
$this->c = 'handleC';
$this->invalidateControl('c');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment