我想在wordpress博客中加入我的magento标题。我已经完成了这个(与these posts类似,但我不需要Magento在标题中加载很多库(例如原型,scriptaculous等)。 p>
我现阶段陷入困境。在将其呈现为html之前,如何从$layout
中删除这些库?
到目前为止,这是我的代码......
<?php
$layout = Mage::app('default')->setCurrentStore( Mage::app()->getStore()->getId() )->getLayout();
global $layout;
if(class_exists('Mage')){
Mage::getSingleton('core/session', array('name' => 'frontend'));
}
$session = Mage::getSingleton('customer/session', array('name'=>'frontend'));
$login_status = '';
if($session->isLoggedIn()) {
$login_status = 'customer_logged_in';
} else {
$login_status = 'customer_logged_out';
}
$layout = Mage::app('default')->setCurrentStore( Mage::app()->getStore()->getId() )
->getLayout();
$layout->getUpdate()
->addHandle('default')
->addHandle('wordpress')
->addHandle($login_status)
->load();
$layout->generateXml()
->generateBlocks();
?>
<html>
<head>
<!-- .... some things .... -->
<?php
wp_head();
echo $layout->getBlock('head')->toHtml();
?>
</head>
答案 0 :(得分:0)
啊......得到它
$layout->getBlock('head')->removeItem('js','prototype/prototype.js');
等...