2

I tried for a hours, but i can't find out. i created static block on header, and i tried to call the header out side of magento. I'm able to connect to magento, but the header is not showed. My code is below

$layout = Mage::getModel('core/layout');

$head = $layout->getBlock('head');
$head->setTemplate('page/html/head.phtml');

$post = get_post( $post );
$metaTitle = pods_field('video', $post->ID, 'meta_title', true);
$metaDescription = pods_field('video', $post->ID, 'meta_description', true);

$head->setTitleWp($metaTitle);
$head->setMetaDescription($metaDescription);

echo $head->toHtml();

And i got the below error.

 Fatal error: Call to a member function setTemplate() on a non-object in 
  • Any one there to help me out of this... – Raj Mohan Oct 18 '16 at 6:37
1

All are quite with other work and i found the solution.

$layout = Mage::getModel('core/layout');
$layout->getUpdate()->load('default');
$layout->generateXml()->generateBlocks();

$head = $layout->getBlock('head');
$head->setTemplate('page/html/head.phtml');

$post = get_post( $post );
$metaTitle = pods_field('video', $post->ID, 'meta_title', true);
$metaDescription = pods_field('video', $post->ID, 'meta_description', true);

$head->setTitleWp($metaTitle);
$head->setMetaDescription($metaDescription);

echo $head->toHtml();

References Link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.