I have created a custom module so that I can call a block from a cms page.
{{block type="wpsync/getpostcontent" template="wpsync/getpostcontent.phtml" wpurl="http://localhost/about"}}
{{block type="wpsync/getpostcontent" template="wpsync/getpostcontent.phtml" wpurl="http://localhost/about"}}
I am getting
exception 'Mage_Core_Exception' with message 'Invalid block type:
Can't see what I am doing wrong.
local/Elevated/Wpsync/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Elevated_Wpsync>
<version>1.0</version>
</Elevated_Wpsync>
</modules>
<global>
<blocks>
<getpostcontent>
<class>Elevated_Wpsync_Block</class>
</getpostcontent>
</blocks>
<models>
<getpostcontent>
<class>Elevated_Wpsync_Model</class>
</getpostcontent>
</models>
</global>
</config>
local/Elevated/Wpsync/Block/Getpostcontent.php
<?php
class Elevated_Wpsync_Block_Getpostcontent extends Mage_Core_Block_Template {
public function getPostContentFromUrl() {
$url = $this->getData('wpurl');
// call model to fetch data
$pagecontent = Mage::getModel("wpsync/getpostcontent")->getPostContentFromUrl($url);
return $pagecontent;
}
}
local/Elevated/Wpsync/Model/Getpostcontent.php
<?php
class Elevated_Wpsync_Model_Getpostcontent extends Mage_Core_Model_Abstract {
public function getPostContentFromUrl($url) {
return "hello";
}
}
app/etc/modules/Elevated_Wpsync.xml
<?xml version="1.0"?>
<config>
<modules>
<Elevated_Wpsync>
<active>true</active>
<codePool>local</codePool>
</Elevated_Wpsync>
</modules>
</config>
app/design/frontend/default/default/template/wpsync/getpostcontent.phtml
<?php
echo $this->getPostContentFromUrl();