views:

94

answers:

1

There are a couple of options that I've used in the past, and I'm interested to hear thoughts on which is best.

  1. manually insert links into top.phtml (urgh...)
    • +easy, quick
    • -users cannot edit
    • -reduces future proofing for upgrades
  2. 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
  3. 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, etc?

Thanks, JD

+1  A: 

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.

Joseph Mastey
heh, that's funny. I was just thinking of that option before I refreshed the page and saw your answer :) A new module that creates an adminhtml form to persist links into the db, then model and layout updates to insert them into `top.phtml` as a foreach `li` element. I haven't seen any modules that use that structure, but it makes sense to me. Thanks for confirming my thoughts!I agree that Option 2 is ugly, if only because it requires instantiation of a `catalog/category_view` block, `cms_block` block and then whatever your `module/block` is... more links in the already long Magento stack
Jonathan Day