inserting links into Magento top nav in a robust, user-friendly manner
There are a couple of options that I've used in the past, and I'm interested to hear thoughts on which is best.
- manually insert links into top.phtml (urgh...)
- +easy, quick
- -users cannot edit
- -reduces future proofing for upgrades
- create a category where the Display Settings is set to Static Block Only with a selected CMS block. The CMS block then calls the content using the
{{block type='custom/module' template='path/file.phtml'}}
syntax.- +Users can edit link titles and targets
- -numerous steps to follow for users
- -CMS editor inserts unwanted characters and an extra layer of processing/markup
- create a static block that is inserted into top.phtml using
echo $this->getLayout()->createBlock('cms/block')->setBlockId('block_name')
syntax- +users can edit link titles and targets in one location
- -users may unintentionally remove ul/li classes required for correct nav display
Are there other options that I'm not aware of, new functionality in v1.4, et开发者_如何学Pythonc?
Thanks, JD
For the most part, that's the decision that I've faced in the past. On number 2 (creating categories), don't forget that it's difficult to create much more than an informational page using this technique. Any page that requires controller logic is effectively blocked out.
Depending on what the actual customer requirement is, another approach would be to add admin configuration options for URL and Label. Your link structure would be more constrained, but you'd be able to enforce ULs, classes, extra classes for the current page, etc. You would probably leverage this on the back of number 1.
精彩评论