0

I am trying to create a custom module and enabling it in a CMS Page.

I've already done this before and everytime some issue comes up and I could figure this out anyhow.

I couldn't figure out what's the issue this time. Below are the code that I've been trying to make it work.

**app/etc/modules/Vickythegme_CMS.xml**
<?xml version="1.0"?>
 <config>
 <modules>
 <Vickythegme_CMS>
 <active>true</active>
 <codePool>local</codePool>
 </Vickythegme_CMS>
 </modules>
 </config>

Module config XML

**app/code/local/Vickythegme/CMS/etc/config.xml**
<?xml version="1.0"?>
<config>
 <modules> 
 <Vickythegme_CMS> 
 <version>0.0.1</version> 
 </Vickythegme_CMS> 
 </modules>
 <frontend>
 <routers>
 <vickythegme_cms_render>
 <use>standard</use>
 <args>
 <module>Vickythegme_CMS</module>
 <frontName>tryon</frontName>
 </args>
 </vickythegme_cms_render>
 </routers> 
 <layout>
 <updates> 
 <vickythegme_cms>
 <file>vickythegme_cms.xml</file>
 </vickythegme_cms>
 </updates>
 </layout> 
 <global>
 <blocks>
 <vickythegme_cms>
 <class>Vickythegme_CMS_Block</class>
 </vickythegme_cms>
 </blocks>
 </global>
 </frontend>
</config>

Design Layout XML File

**design/frontend/base/default/layout/vickythegme_cms.xml**
<layout version="0.1.0">
 <default>
 <reference name="content" />
</default>
<vickythegme_cms_render_index_index>
 <reference name="content">
 <block type="cms/tryon" name="tryon_tryon" template="cms/tryon.phtml" />
</reference>
</vickythegme_cms_render_index_index>
</layout>

Block tryon.php file

**code/local/Vickythegme/CMS/Block/tryon.php**
class Vickythegme_CMS_Block_Tryon extends Mage_Core_Block_Template
{
 public function methodblock()
 {
 return 'testing block';
 }
}

Controller File

**code/local/Vickythegme/CMS/controllers/IndexController.php**
class Vickythegme_CMS_IndexController extends Mage_Core_Controller_Front_Action
{
 public function indexAction()
 {
 $this->loadLayout();
 $this->renderLayout();
 }
 public function methodAction()
 {
 echo 'test method';
 }
}

tryon phtml file

**design/frontend/base/default/template/vickythegme/cms/tryon.phtml**
test content

I've cleared the cache and tried as well. Its not working.

The url that I am checking

http://magento-15667-34663-87261.cloudwaysapps.com/try-on

try-on is the CMS Page that I created with the block code

{{block type="cms/tryon" name="tryon_tryon" template="cms/tryon.phtml"}}

And the page url that I should be checking directly gives me 404 error.

http://magento-15667-34663-87261.cloudwaysapps.com/tryon/index

And btw, I've enabled logging, still I don't get any error in the log related to this module.

I'm not even sure whether the module is running or not.

I'm not sure what's happening. If you guys could help me out in this issue, it'd be really awesome.

Thanks in advance.

asked Feb 11, 2016 at 13:06

1 Answer 1

0

Your block type is vickythegme_cms/tryon and not cms/tryon. And your template is vickythegme/cms/tryon.phtml and not cms/tryon.phtml.

You block must be nammed Tryon.php and not tryon.php.

Also you need to allow your block under System> Permissions> Blocks if you're running Magento 1.9.2.2.

Also your config xml global tag is not place properly, it should be like this:

<?xml version="1.0"?>
<config>
 <modules> 
 <Vickythegme_CMS> 
 <version>0.0.1</version> 
 </Vickythegme_CMS> 
 </modules>
 <frontend>
 <routers>
 <vickythegme_cms_render>
 <use>standard</use>
 <args>
 <module>Vickythegme_CMS</module>
 <frontName>tryon</frontName>
 </args>
 </vickythegme_cms_render>
 </routers> 
 <layout>
 <updates> 
 <vickythegme_cms>
 <file>vickythegme_cms.xml</file>
 </vickythegme_cms>
 </updates>
 </layout> 
 </frontend>
 <global>
 <blocks>
 <vickythegme_cms>
 <class>Vickythegme_CMS_Block</class>
 </vickythegme_cms>
 </blocks>
 </global>
</config>
answered Feb 11, 2016 at 13:12
9
  • Hi, @digital-pianism, Thanks for the reply. I tried that one as well.. It's not working. Any other places where I go wrong? Commented Feb 11, 2016 at 13:30
  • Yeah try changing your layout handle from <vickythegme_cms_render_index_index> to <tryon_index_index> Commented Feb 11, 2016 at 13:40
  • That's not working either.! And I'm guessing that won't be a problem because that is for showing the page directly and I'd atleast need the try-on CMS Page to work which is related to your first comment and sadly that's not working either. Commented Feb 11, 2016 at 14:02
  • What's the content of your phtml file ? Commented Feb 11, 2016 at 14:04
  • See my edited answer Commented Feb 11, 2016 at 14:06

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.