I'm trying to write a module with a custom block that inject some javascript to the page head. no matter what I do I keep getting "invalid block type" error.
Note: I went over all the questions here about "invalid block type" and none of them worked / were relevant.
my extension files look like this:
my config file (Packname/Core/etc/config.xml):
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Packname_Core>
<version>0.1.0</version>
</Packname_Core>
</modules>
<global>
<blocks>
<packname_core>
<class>Packname_Core_Block</class>
</packname_core>
</blocks>
</global>
<frontend>
<layout>
<updates>
<packname>
<file>packname_core.xml</file>
</packname>
</updates>
</layout>
</frontend>
</config>
my layout file (design\frontend\base\default\layout\packname_core.xml):
<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
<default>
<reference name="head">
<block type="packname_core/injectjs" name="packnameJs" as="packnameJs" template="packname/injectjs.phtml" />
</reference>
</default>
</layout>
and my block file (Packname\Core\Block\Injectjs.php):
<?php
class Packname_Core_Block_Injectjs extends Mage_Core_Block_Template
{
public function getPacknameJsUrl()
{
return Mage::helper('packname_core/config')->getJsUrl();
}
}
now the error I'm getting looks like this:
exception 'Mage_Core_Exception' with message 'Invalid block type: Packname_Core_Block_Injectjs' in C:\Bitnami\magento-1.9.2.1-1\apps\magento\htdocs\app\Mage.php:595
the name Packname_Core_Block_Injectjs seems correct, I already double checked uppercase/lowercase issues, and I can't figure out what's wrong.. everything seem in place.
note that if I set block type to something like "core/html" I no longer get the error, but then offcourse I can't access my block functions.
any help will be greatly appreciated! thanks,