views_embed_view returns different html when inside page than inside a module
zzadik - October 21, 2009 - 15:09
Hello,
I'm using the views carousel module, and loads the view from my code.
I've placed the following code inside a page:
<?php
//view name: uc_products_by_category
//display: block_carousel
//args: 1
$output = views_embed_view('uc_products_by_category', 'block_carousel_1', 1) ;
print $output;
?>This works fine.
however, when I place the exact same code in a custom module I'm writing, the views_embed_view function returns a different html which causes the carousel to look "raw".
This is the code I use in my module:
<?php
function products_menu() {
$items['products_by_cat'] = array(
'page callback' => 'products_get_by_category',
'type' => MENU_CALLBACK,
'access arguments' => array('prods content'),
);
return $items;
}
function products_get_by_category($tid) {
$output = views_embed_view('uc_products_by_category', 'block_carousel_1', 1) ;
print $output; // This is just to verify I get the expected html
}
?>I would appreciate any help.
Thanks
Zion
