exception ‚Latte\RuntimeException‘ with message ‚Cannot include undefined block 'content‘
- vosy
- Člen | 532
Ahoj, chci udelat vyskakovaci dialog okno jQueryUI a v ne mit blok ohraniceny snippetem.
mam v presenteru
public function handleDialogPresenter()
{
$file = dirname(__FILE__).'/../templates/dialog.phtml';
$template = $this->createTemplate();
$template->setFile($file);
$html = $template->__toString();
$return = array(
'ok'=>true,
'html'=>$html);
echo json_encode($return);
$this->terminate();
}
a v sablone dialog.phtml
<fieldset>
<legend>V dialugu presenteru</legend>
{snippet mySnippet}
<div id="presenterCont">
{time()}
</div>
{/snippet mySnippet}
</fieldset>
a fce Exception in Nette\Bridges\ApplicationLatte\Template::__toString()
mi vyhodi error jako by to nemelo rado {snippet mySnippet}
- vosy
- Člen | 532
sablona presenteru
{block content}
<div id="content">
<fieldset>
<legend>V presenteru</legend>
{snippet presenterContainerSnippet}
<div id="presenterCont">
{time()}
</div>
{/snippet}
{form reloadSnippetPresenterForm}
{input reloadSnippet class=>"ajax"}
{/form}
</fieldset>
{control tabControl}
<br/><br/>
<button id="dialogPresenter" data-url="{$control->link('dialogPresenter!')}" class="ajax">Dialog z presenteru</button>
<br/><br/>
<footer>Nette Framework {Nette\Framework::VERSION}</footer>
</div>
{/block}
a layout.phtml
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{ifset #title}{include title|striptags} | {/ifset}Nette Sandbox</title>
<link rel="stylesheet" media="screen,projection,tv" href="{$basePath}/css/screen.css">
<link rel="stylesheet" media="print" href="{$basePath}/css/print.css">
<link rel="shortcut icon" href="{$basePath}/favicon.ico">
<link href="{$basePath}/plugins/jquery-ui/1.10.3/themes/ui-lightness/jquery-ui.min.css" rel="stylesheet" media="screen">
<script type="text/javascript" src="{$basePath}/plugins/jquery/1.10.2/min.js"></script>
<script type="text/javascript" src="{$basePath}/plugins/jquery-ui/1.10.3/jquery-ui.min.js"></script>
<script type="text/javascript" src="{$basePath}/plugins/netteAjax/nette.ajax.js"></script>
<script src="{$basePath}/js/main.js"></script>
</head>
<body>
{include content}
</body>
</html>
cely sandbox mam tady
"":http://nette.vosy.cz/…gSnippet.zip
Editoval vosy (30. 12. 2014 17:42)
- vosy
- Člen | 532
{time()}
ale {?time()} nefunguje
mam problem v externe nacitane sablone a snippetem nevim jak se tam dostava
@layout.phtml a tam to hleda
{include #content}
ale ja nacitam
$file = dirname(__FILE__).'/../templates/dialog.phtml';
a tam je
<div>
<fieldset>
<legend>V dialugu presenteru</legend>
{snippet mySnippet}
<div id="presenterCont">
xx
</div>
{/snippet}
</fieldset>
</div>
kdyz tam nemam
{snippet mySnippet}
tak vse funguje
- Bendergast
- Člen | 8
vosy napsal(a):
{time()}
ale {?time()} nefunguje
mam problem v externe nacitane sablone a snippetem nevim jak se tam dostava @layout.phtml a tam to hleda{include #content}
ale ja nacitam
$file = dirname(__FILE__).'/../templates/dialog.phtml';
a tam je
<div> <fieldset> <legend>V dialugu presenteru</legend> {snippet mySnippet} <div id="presenterCont"> xx </div> {/snippet} </fieldset> </div>
kdyz tam nemam
{snippet mySnippet}
tak vse funguje
Taky jsem se s tím pral, tak kdyby to někomu pomohlo:
V includovane šabloně jsem nastavil:
{layout null}
A místo handle jsem použil action a vše funguje krásně
Editoval Bendergast (18. 7. 2015 16:32)