That problem is SOLVED AND WORKING
When i load page by ajax, dynamic content like gallery or slideshow ,
shows only {! filemanager/slideshow?path=design/sponsorzy !}
HTML result is not rendering, all other content is OK.
JS for ajax
xhr = jQuery.ajax({
scriptCharset: "utf-8" ,
contentType: "application/json; charset=utf-8",
type: "GET",
url: '/blog/ajax/'+'?type='+type+'&id='+addres[3],
..............
My handler for ajax calls is:
<?php
/**
* Displays a single blog post or a page from ajax call.
*/
$page->layout = false;
header ('Content-Type: application/json');
$type = $_GET['type'];
$id = $_GET['id'];
if($type=='blog'){
$posts = blog\Post::query ()
->where ('published', 'yes')
->where ('id', $id)
->fetch (2);
$json = array(
'body' => $tpl->run_includes ($posts[0]->data['body']),
'title' => $posts[0]->data[title],
'ts' => $posts[0]->data[ts],
'published' => $posts[0]->data[published],
'tags' => $posts[0]->data[tags],
'author' => $posts[0]->data[author]
);
echo json_encode($json);
}
if($type=='page'){
$posts = Webpage::query ()
->where ('title', (string)$id)
->fetch (1);
$json = array(
'body' => $tpl->run_includes ($posts[0]->data['body']),
'title' => $posts[0]->data[title],
'ts' => $posts[0]->data[ts],
'published' => $posts[0]->data[published],
'tags' => $posts[0]->data[tags],
'author' => $posts[0]->data[author]
);
echo json_encode($json);
}?>
Is there a way to render content from page?
Comments
Just reformatting to make your code a bit easier to follow:
JS for ajax:
Handler:
I see what you mean. You'll want to pass the body through
$tpl->run_includes()
like this:thank you :)
Thank's everything is working:)