Embedding megamenu in theme

Permalink Browser Info Environment
Hi,

Is it possible to embed megamenu in the theme, and if so. Could you supply the embedding code with description of all parameters.

In normal autonav the code is like this:

$bt = BlockType::getByHandle('autonav');
$bt->controller->displayPages = 'top';
$bt->controller->orderBy = 'display_asc';
$bt->controller->displaySubPages = 'all';
$bt->controller->displaySubPageLevels = 'custom';
$bt->controller->displaySubPageLevelsNum = '3';
$bt->render('templates/topmenu'); (name of the template)

Description:
$bt->controller->displayPages = 'top';

option value="top" at the top level.
option value="second_level" at the second level.
option value="third_level" At the third level.
option value="above" At the level above
option value="current" At the current level
option value="below" At the level below.
option value="custom" Beneath a particular page / ID


$bt->controller->displayPagesCID = '0';

If menu start fro a particular page ID

$bt->controller->orderBy = 'display_asc';

<option value="display_asc" in their sitemap order.
<option value="chrono_desc" with the most recent first.
<option value="chrono_asc" with the earliest first.
<option value="alpha_asc" in alphabetical order.
<option value="alpha_desc" in reverse alphabetical order.'
<option value="display_desc" in reverse sitemap order.

$bt->controller->displaySubPages = 'relevant';

<option value="none"
<option value="relevant" Relevant sub pages.'
<option value="relevant_breadcrumb" Display breadcrumb trail.'
<option value="all" Display all.

$bt->controller->displaySubPagesLevels = 'all';

<option value="enough" Display sub pages to current.
<option value="enough_plus1" Display sub pages to current +1.')
<option value="all" Display all.
<option value="custom" Display a custom amount.

It would be realy nice to have a description of this. And secondly some info about witch css and js files to load to be able to embed the menu!

Regards Michael

Type: Discussion
Status: New
maar
View Replies: View Best Answer
jb1 replied on at Permalink Reply
jb1
Hi Michael,
I actually have a video about my recommended method for using mega menu across your site (found on c5extras.com). Here's a direct link:
http://www.youtube.com/watch?v=TBDw8uYk048&feature=youtube_gdat...

Hard coding it into the theme is problematic due to the way c5 renders a page.

Hope this helps.

JB

- Sent from my iPhone
maar replied on at Permalink Reply
maar
Hi JB,

I all ready seen your videos. And have used your method a lot. That works fine for a single theme site.

The solution I am looking for is not for final customer site. It is on my own site. I would like to be able to use your megamenu in my themes that is going to be sold on my website. The point is that I would like to use "Theme Switcher" to be able to show different themes with your megamenu - that envolves changing the color template!

Can this be done!

Michael
jb1 replied on at Permalink Reply
jb1
Hi Michael, ok I understand.
Yes it is possible to do what you're suggesting but I don't have any ready-made code that I can supply as a guide. But the tips I can provide are:
- you need to manually pull in the JavaScript and CSS files used by mega menu by hard coding them into your theme (header.php file). This is because of a limitation with the way the view.php for a block is rendered in c5.
- when adding the above make sure it's after the c5 required portion of the template as this is where jquery will be pulled in and it must be before mega menu.

Hope this helps. Let me know how you go.

JB
jb1 replied on at Permalink Reply
jb1
PS. have a look at the db.xml file for the list of field names you can use.
maar replied on at Permalink Best Answer Reply
maar
Hi JB,

OK, this was fairly easy. Here it goes:

The css and js to embed is:

<link href="/packages/jb_megamenu/blocks/jb_megamenu/css/dcmegamenu.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/packages/jb_megamenu/blocks/jb_megamenu/js/jquery.dcmegamenu.1.3.2.js"></script>
<script type="text/javascript" src="/packages/jb_megamenu/blocks/jb_megamenu/js/jquery.hoverIntent.minified.js"></script>
<script type="text/javascript" src="/packages/jb_megamenu/blocks/jb_megamenu/js/jquery.KeyTips.js"></script>
<link href="/packages/jb_megamenu/blocks/jb_megamenu/css/skins/black.css" rel="stylesheet" type="text/css" />


And to insert the embedded php code for the menu is:

<div class="black"> <!-- Remember this, change class to your color -->
  <?php if ($c->isEditMode()) { ?> /* Start of remove menu code under page edit */
  <div style="padding-left:30px">
    <p>Menu removed when editing page</p>
  </div>
  <div style="padding-top:50px">
  <?php } else { /* End of remove menu under page edit */?>
  <?php /* Start of embedding megamenu */
    $bt = BlockType::getByHandle('jb_megamenu');
    $bt->controller->displayPages = 'top';
    $bt->controller->orderBy = 'display_asc';
    $bt->controller->displaySubPages = 'all';
    $bt->controller->displaySubPageLevels = 'all';
    $bt->controller->skin = 'black'; /* Remember to change according to color scheme */
    $bt->controller->effect = 'fade';


That is working - Thanks for your help!

Regards Michael
jb1 replied on at Permalink Reply
jb1
Great to hear you've got it working. If you're able to leave a positive review in the c5 marketplace that would be hugely appreciated.

JB
maar replied on at Permalink Reply
maar
Hi JB,

Thank's again for your help... I will try to write something. If you want to see your menu's in action with theme switching. Then visithttp://concrete5.maargrafisk.dk... - You are able to switch themes in the dropdown in top right corner!

Regards Michael
jb1 replied on at Permalink Reply
jb1
Hi Michael, nice job on the theme switcher, and I appreciate the review, than you very much :-)

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.