tags:

views:

38

answers:

1

Hi,

So far i have found two ways of liking a category to a customized module. By Category i mean created in Admin->Catalog->Manage Categories->created new category. By Customized module i mean module created in code(app/code/local)

  1. way to link Till today I used Admin->Catalog->Url Rewrite Manager to direct some category(blog) to some customized module(blog/index/index). So, in Url Rewrite manager I created rewrite entry that had Request-Path hold Category Url-key(blog-index.phtml) and Target-Path hold my costumized module path (blog/index/index). It stop redirecting today by having automatically putting different target path (catalog/category/view/s/blog-index/id/)...i am not sure why

2.way to link In category layout xml file I put handle



        
            
            
            
        

This does the work but it requires to mess with category module that i prefer not to do. It also has link(catalog/category/view/s/blog-index/id/) that does not favor search engines

Is there better way to link category to my costumized module?

+1  A: 

The layout XML can go in your module's layout XML file (layout/blog.xml for example) if you'd prefer, the file that layout XML resides in has little importance (you'll need a <layout> section in your config.xml if you don't already have one)

Greg
the blog.xml layout file will not be read unless frontend router for that module is called, isn't that so?...so, i have to rewrite the category url(blog-index.phtml) in order to call the blog module frontend router...Unless that happens putting it in blog.xml file would not matter.
latvian
provided the module is loaded, and the module's config.xml has a <layout> section pointing at blog.xml, then it will be loaded on every page load. Whether the "updates" in it are applied to the page will depend on the "handles" matching the current route (or 'default', or any of the special handles that some modules add) - so it won't apply blog_post_index (or whatever the tag-name happens to be), but any handles in the file that do match a route will be applied.
Greg
Thank you Greg for responding and helping me to solve this mystery...i think i got itMy mistake was thinking that only the modules(layout.xml) files will be loaded/applied which correspond to the current front end route module. You are right all of the layout.xml files are loaded and based on the handles matching the current route is applied. Now,I inserted the <category_228> tag into blog.xml and it is applied when clicked on blog link in catogory menu. No rewrites are needed and i don't have to touch catalog module in any way to make this work....great! that's it. Thank You
latvian