ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Custom Category menu - help required

June 16, 2011 3:06pm

Subscribe [5]
  • #16 / Jun 22, 2011 4:55am

    Richard Wiggins

    60 posts

    Hi Leon,

    Sorry for the slow reply, as mentioned I’ve been away for a few days.

    You are one smart cookie! That looks supercool and can’t wait to have a play. By the looks of this, your plugin is gonna rock even more and be so flexible - I don’t think anything else is going to come close with regards to categories. This is an area where native EE control/support is really lacking and your plugin will I’m sure become the defacto.

    After catching up with email and admin etc, I’ll be back onto this project today, so please do send over your latest version and I’ll give it a go.

    Thanks again Leon, you really couldn’t be any more helpful. You should really have a ‘donate/buy me a beer’ button on your site! Don’t suppose you’re over in the UK for EEUK in August?

    Cheers,

    Richard

  • #17 / Jun 22, 2011 1:08pm

    Leon Dijk

    131 posts

    Hi Richard,

    No problem, I could use your away time for testing 😊

    Thanks for the kind words! I wish I could come to EEUK, I’m sure it will be awesome.
    I went to EECI 2010, but hey, that was close to where I live 😊

    I’ll send you a PM with the download link so you can give it a go. I’ll probably make one small adjustment before I release it, but that’s not going to affect how you would use the plugin for your menu.

    Let me know if you get it to work or if you run into any problems!

    Cheers,
    Leon

  • #18 / Jun 22, 2011 1:31pm

    Richard Wiggins

    60 posts

    Hey Leon,

    I did think about going to EECI 2010 myself, but it was bad timing, work and financially.

    Thanks for the PM. I’ve just installed the updated plugin and will try and give it some testing a bit later today/tonight.

    Thanks again.

    Regards,

    Richard

  • #19 / Jun 23, 2011 12:25pm

    Leon Dijk

    131 posts

    Hi Richard,

    Pretty much the same reason why I can’t attend EEUK. The costs go up pretty quickly with a flight ticket and hotel room..and I might also be on vacation at that time. I’m sure you’ll have a great time there!

    Let me know when you’ve done some testing! I’ve made a couple of small adjustments for the EE1 version since I sent you the PM, but I haven’t touched the EE2 version so if everything is working for you I think I’m going to release it in it’s current state.

    Cheers!
    Leon

  • #20 / Jun 23, 2011 1:13pm

    Richard Wiggins

    60 posts

    Hi Leon,

    I haven’t had a chance to try out your specific code that I was struggling with, mainly as I need to discuss stuff around this with the client and waiting on them.

    I have regenerated my left “mega menu” now using your new code though and it works great. My new code looks like:

    <ul id="menuleft" class="group">
    {exp:gwcode_categories channel="products" group_id="1" style="linear"}
        {if depth1_start}
            <li class="drop">
            <a href="http://{path=products/{cat_url_title}}">{cat_name}</a>
        {/if}
            {if depth2_start}
                <div class="dropdown">
                    <h2>{cat_name}</h2>
    <p>                <ul><br />
            {/if}<br />
            {if depth == 2}<br />
                <li><br />
                    <a href="http://{path=products/{cat_url_title}}">{cat_name}</a><br />
                </li><br />
            {/if}<br />
            {if depth2_end}<br />
                    </ul><br />
                </div><br />
            {/if}<br />
        {if depth1_end}<br />
            </li><br />
        {/if}<br />
    {/exp:gwcode_categories}<br />
    </ul>

    You can view it here and by rolling over the left Products menu.

    Thanks again Leon, you ‘da man’!

  • #21 / Jun 23, 2011 3:31pm

    Leon Dijk

    131 posts

    Hey Richard,

    Very nice, almost the same as the code I created to generate your left menu. The only difference being that I added the div with dropdown class in the depth_1_start section and the closing div in the depth1_end, but the end results are the same 😊 Good job!

    I’m glad to see this is working. Once you are ready, you should definitely be able to generate your second menu.

    Thanks so much for your ideas and thinking along Richard, these new features have turned out to be really great and I would have never thought of them if you didn’t start this thread. If you need further help with your second menu, just let me know. Since everything seems to be working fine, I’m going to add the new release for download and update the docs.

    Cheers!
    Leon

  • #22 / Jun 23, 2011 3:41pm

    Richard Wiggins

    60 posts

    Hey Leon,

    Yeah, it seems to work fine and I’m sure your code suggestion for the other menu will work great, but I’ll let you know if I run into any issues.

    No, thank you for being able to solve my problem, and for an awesome plugin. Keep up the excellent work!

    Cheers, Richard.

  • #23 / Jul 10, 2011 4:57am

    Richard Wiggins

    60 posts

    Hi Leon,

    Hope you’re keeping well.

    Hope you remember me - I’m the one who prompted you to make a load of hassle to add in extra category control for your Categories plugin 😊

    Anyway, I’m only just getting around to creating that complicated ‘mega menu’ using your code sample, as there was some delays in the project. Unfortunately I can’t get it to work.

    Basically, when I was running the version of the plugin that you sent me, {if depth1_start AND depth1_start_count == 1} does seem to fire correctly, but {if depth1_end AND depth1_end_count == 2} doesn’t appear to do anything.

    So I went and downloaded the latest version (1.8.0) from your site and installed that, caused the following error:

    Message: Invalid EE Conditional Variable: {if "1"2_start}

    Filename: libraries/Functions.php

    Line Number: 2814

    Any ideas what’s going on or why your code doesn’t seem to work for me?

    Sorry to be a pain.

    Regards,

    Richard

  • #24 / Jul 10, 2011 7:45am

    Leon Dijk

    131 posts

    Hey Richard,

    Sure do remember!

    Looking at the error you’re receiving, it looks like you’re using different code than what I posted?
    You’re using

    {if depth1_end AND depth1_end_count == 2}

    but I’m using

    {if depth1_end AND depth1_end_count == 3}

    or

    {if depth1_end AND depth1_end_count == 6}

    So I’m guessing you changed something in the code? I’m guessing something went wrong there because the plugin should never cause an error like that.

    Could you provide the complete code you’re using?

    By the way, I have used your problem as an example on the site:
    http://gwcode.com/add-ons/gwcode-categories/examples/example11

    So you can grab the code from there as well 😊

  • #25 / Jul 10, 2011 8:54am

    Richard Wiggins

    60 posts

    Hi Leon,

    I did start off by using the complete code you supplied but it was breaking my HTML as it wasn’t closing off at least one div.

    I’m currently just trying to get your code to do something very basic:

    {exp:gwcode_categories channel="industries" style="linear"}
        {if depth1_start AND depth1_start_count == 1} {!-- opening code for the first main/root category --}
            Start
        {/if}
        {cat_name}
        {if depth1_end AND depth1_end_count == 3} {!-- if the 3rd main/root category has been displayed --}
            End
        {/if}
    {/exp:gwcode_categories}

    You can see my page here:
    http://ec2.dragonstaff.com/www.strainsense.co.uk/index.php/industries/aerospace

    I wasn’t getting any PHP errors until I installed 1.8.0 from your site, though the previous version still wasn’t working for me. Bit confused.

    I did notice Example 11 for thought it looked familiar 😊

  • #26 / Jul 10, 2011 6:29pm

    Leon Dijk

    131 posts

    Hi Richard,

    That’s weird, I swear I posted a reply earlier today..guess I didn’t hit the Submit Post button or something :(

    Anyway, what I wanted to ask is:

    Could you change your code to this for example, to see what value the depth1_end_count variable contains? That way we can see why it isn’t going into that if statement:

    {exp:gwcode_categories channel="industries" style="linear"}
        {if depth1_start AND depth1_start_count == 1} {!-- opening code for the first main/root category --}
            Start
        {/if}
        {cat_name} ({depth1_end_count})
        {if depth1_end AND depth1_end_count == 3} {!-- if the 3rd main/root category has been displayed --}
            End
        {/if}
    {/exp:gwcode_categories}

    I’m as puzzled as you are why this wouldn’t work. I created the exact same menu perfectly using the code on the Example 11 page. When I get back from work tomorrow, I’ll double check to see if there’s something wrong with it.

    If you can show me a screenshot of what your category group looks like (just to be sure it’s exactly the same as what I have on my local installation), that would be great. If you don’t want to show it here, feel free to DM me on twitter, or PM here.

  • #27 / Jul 11, 2011 3:15am

    Richard Wiggins

    60 posts

    Hi Leon,

    No worries.

    I’ve changed the code to that example which you can again see under the Industries menu here: http://ec2.dragonstaff.com/www.strainsense.co.uk/index.php/industries/general. End is still not displaying.

    There was something in your original example menu code that was causing the php errors, even though I had commented it out, it was being picked up by EE, so I’ve deleted that completely for now.

    My Category Group had now been simplified, as for this section now we only have one level deep of cats and then just channel entries, but a lot of your code will still be required to output the right structure. I’ve still attached a screenshot of my categories.

    FYI: I’m around for limited time today but flying out to Spain early tomorrow (12th) and not back until the 24th. Would have been nice to get this going before I’m away, but really not critical so don’t rush at all.

    Thanks Leon and again, sorry to be a hassle.

  • #28 / Jul 11, 2011 3:37pm

    Leon Dijk

    131 posts

    Hi Richard,

    Ah yes, that changes things 😊

    What you’re doing here:

    {if depth1_end AND depth1_end_count == 3} {!-- if the 3rd main/root category has been displayed --}
            End
        {/if}

    ..doesn’t work because depth1_end_count will never have the value 3, because the subcategories have been removed.

    When you look at your menu now, you’ll see that the “depth1_end_count” value will be 0 for all categories but the last one. For the last category, it will have the value 1.

    So, in order to get the “End” there, you’ll need to change your code to:

    {exp:gwcode_categories channel="industries" style="linear"}
        {if depth1_start AND depth1_start_count == 1}
            Start
        {/if}
        {cat_name}
        {if depth1_end AND depth1_end_count == 1}
            End
        {/if}
    {/exp:gwcode_categories}

    Or, because you no longer have subcategories, you could also use this simpler code:

    {exp:gwcode_categories channel="industries" style="linear"}
        {if depth1_start}
            Start
        {/if}
        {cat_name}
        {if depth1_end}
            End
        {/if}
    {/exp:gwcode_categories}

    So, that should now be working. But I’m sure this isn’t the complete code you’re looking for right? Because you could have easily done that with the standard EE tags. If you need further help getting the correct code output for the menu, let me know!

    No hurry, have a good time in Spain, I’ll keep an eye on this thread 😊

  • #29 / Jul 11, 2011 5:54pm

    Richard Wiggins

    60 posts

    Thanks Leon, sorry about being a PITA!

    Just packing now so I’ll take a proper look when I’m back, but thanks. Didn’t realise that not having the sub-categories would screw it up.

    Thanks for your code, I’m sure it will get it part-way there but I still need to split the main categories into two columns. I’ll have a play when I return.

    Cheers, Richard.

  • #30 / Jul 26, 2011 7:07pm

    Richard Wiggins

    60 posts

    Hi Leon,

    I’m back in the UK and still sort of in catch-up mode, but just getting around to look at this category menu.

    I do understand a bit more how your plugin was working now so see how when I dropped the sub-categories for Channel Entries that it would stop it working.

    I think I can get a lot of it working now, but I somehow need to do a count on the top-level categories, so I can split it into two rows of three. I’m guessing there isn’t currently a way with your plugin that I can count and split these top-level categories?

    Not asking you to start writing more code but curious. If not I’ll try to figure out if I can do it a different way.

    Cheers, Richard

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases