Skip to content

Latest commit

 

History

History
37 lines (31 loc) · 1.19 KB

RequestHandler.md

File metadata and controls

37 lines (31 loc) · 1.19 KB

RequestHandler component

This component was dropped in v5. If you come from v4 and upgrade your app, this can be a 1:1 replacement to allow using the same code as before until further refactoring is possible.

Load e.g. using

$options = ['viewClassMap' => ['rss' => 'Feed.Rss'], 'enableBeforeRedirect' => false];
$this->loadComponent('Shim.RequestHandler', $options);

Auto AJAX Layout switching

One of the useful functionality of this component is the globally available auto switch for e.g. AJAX layout (= none), rendering out the same page without the surrounding layout.

This can be useful when rendering AJAXified pagination.

<?php $this->append('script');?>
<script type="text/javascript">
$(document).ready(function() {
	$('body').on('click', 'div.paging a', function() {
		$('div#messageContainer').fadeTo(300, 0);

		var thisHref = $(this).attr("href");

		$('div#messageContainer').load(thisHref, function() {
			$(this).fadeTo(200, 1);
			$('html, body').animate({
				scrollTop: $("#messageContainer").offset().top
			}, 200);
		});
		return false;
	});
});
</script>
<?php $this->end();?>

With the RequestHandler this works out of the box with the same template file(s).