I use a page-front.tpl.php file and for some reason, my ajaz-powered mini-pager on an embedded view wasn't working and instead was causing a "...?page=1" full page reload. When I look at page source, none of the js scripts are loading, only the css. I have the necessary php code calling the $scripts, I haven't touched that.
I'm embedding views like this:
<?php
print views_embed_view('MemberSearch', 'block_2');
?>
I've got similar embedded views working around the site, but none of them are in a template file - they've all been used in normal Page content types by entering under the "Edit" tab.
to test this out, I deleted the page-front template file and put the exact same embedded view into the node using the "Edit" tab...and all the scripts loaded as expected.
why would having a page-front.tpl.php file cause scripts not to load? Is this by design or something you've heard about before? Is it a particular issue perhaps with the view embedding - it does cause scripts to load throughout the rest of the site, but not when using page-front.
Comments
Comment #1
johnalbinThis is why you should never embed a View in a template file.
The page.tpl loads the javascripts before you call views_embed_view(), so its literally too late for views_embed_view() to add scripts at that time.