Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#286 2015-05-05 08:48:02

etc
Developer
Registered: 2010-11-11
Posts: 5,661
Website GitHub

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Sorry, I was away from the forum for a while. Just to be sure: you want to insert into “huts-campsites-te-araroa” section listing the articles with “te-araroa” category, without repetitions and in the alphabetical order (the last is the hardest part)? If we drop the alpha order for the moment, this should work (untested):

<nav role="navigation">

<txp:variable name="menu1">
  <txp:adi_menu menu_id="" class="menu" active_class="current" current_children_only="1" parent_class="" articles="1" active_articles_only="1" article_attr='sort="title" status="live" class="menu_article"' sort="adi_menu_sort" article_position="before" />
</txp:variable>

<txp:if_section name="huts-campsites-te-araroa">

  <txp:etc_query name="te-araroa" markup="db" populate="article" wraptag="ul" break="li" class="menu_article" limit="100"
    data="(Category1='te-araroa' OR Category2='te-araroa') AND Section !='huts-campsites-te-araroa' ORDER BY Title">
      <txp:permlink><txp:title /></txp:permlink>
  </txp:etc_query>

  <txp:etc_query data="{?menu1}"
    replace='//a[@href="<txp:section name="huts-campsites-te-araroa" url="1" />"]$={?te-araroa}' />

  <txp:else />

  <txp:variable name="menu1" />

</txp:if_section>
</nav>

Be sure to (re)download the latest etc_query version. If it works, we will see for the order.

Edit: or even this:

  ...
  <txp:etc_query name="te-araroa" markup="db" populate="article" wraptag="ul" break="li" class="menu_article" limit="100"
    data="(Category1='te-araroa' OR Category2='te-araroa' OR Section='huts-campsites-te-araroa') ORDER BY Title">
      <txp:permlink><txp:title /></txp:permlink>
  </txp:etc_query>

  <txp:etc_query data="{?menu1}"
    replace='//a[@href="<txp:section name="huts-campsites-te-araroa" url="1" />"]={?te-araroa}' />
  ...

Last edited by etc (2015-05-05 14:39:14)

Offline

#287 2015-05-05 08:54:41

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 177
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Wow, that was speedy.

9pm here in New Zealand, we like to get our days over early, so I might leave this brain teaser until morning.

Thanks again.

Offline

#288 2015-10-23 16:05:24

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Hi Adi,

I’d like to suggest a little modification at the end of adi_menu_lineage when $linkclass is empty :

$out[] = tag($crumb,'a',' ' .($linkclass ? 'class="'.$linkclass.'"' : ''). ' href="'.$section_list[$child]['url'].'"') :

Offline

#289 2015-10-26 00:55:05

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

CeBe wrote #296145:

Hi Adi, I’d like to suggest a little modification …

A fine suggestion, thanks.

Offline

#290 2016-01-15 09:19:43

debeo
Member
Registered: 2012-09-24
Posts: 16

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Is there a limit of section you can have? I’ve reached 123 and can’t rearrange them anymore. When I click ‘Update menu’ it just takes me to write tab and nothing happens. If I delete one or more sections it works until I hit 123 again.

Offline

#291 2016-01-15 09:45:01

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

debeo wrote #297398:

Is there a limit of section you can have? I’ve reached 123 and can’t rearrange them anymore. When I click ‘Update menu’ it just takes me to write tab and nothing happens. If I delete one or more sections it works until I hit 123 again.

It’ll be because you’re exceeding the max_input_vars setting in your PHP installation. The more sections there are, the more fields there are and hence input vars. If you’re in control of PHP adjust the limit in php.ini, if not ask your hosting provider nicely.

Offline

#292 2016-01-15 09:53:31

debeo
Member
Registered: 2012-09-24
Posts: 16

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Thank you for super prompt reply!

Offline

#293 2016-01-20 11:45:32

sochicomputerRU
Member
From: Россия
Registered: 2013-01-18
Posts: 61
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

How to exclude clone?

I have section services, and it is cloned (i.e. All Service). Now in my contacts page I want to exclude the clone.

<txp:adi_menu include_children=“1” sections=“services” include_parent=“0” />

Offline

#294 2016-01-20 23:00:50

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

sochicomputerRU wrote #297503:

How to exclude clone?

I have section services, and it is cloned (i.e. All Service). Now in my contacts page I want to exclude the clone.

<txp:adi_menu include_children=“1” sections=“services” include_parent=“0” />

Had a chat off-forum and the solution was to download the latest 1.4 beta and use this on the page:

<txp:adi_menu sections="услуги" include_parent="0" exclude_clone="1" />

- which basically says: output the menu for “услуги” (services) and it’s children, but don’t show “услуги” itself or its clone

Last edited by gomedia (2016-01-21 11:30:25)

Offline

#295 2016-03-13 08:57:57

bsaner
Member
Registered: 2011-04-11
Posts: 11

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

please forgive me because i’m terrible with design. i’m more backend (heck, if you want nginx with url rewrites a mile long and SSL session caching or the like, i’m your guy. if you want an actual website, well…).

i was wondering if it’s possible to make the childen only appear on hover of the parent. i don’t have, and was hoping to avoid, actual pages for the parents as it’s unnecessary/irrelevant for my implementation and would serve to only give an extra load of a page i wouldn’t need and would feel forced/unnatural with the rest of the design. i could disable clicking of the parents, but then of course the children won’t be able to be chosen in the current form… right?

also, is it possible to display the list of children vertically instead of horizontally?

for what it’s worth, i’m using PHP 7.0.4, nginx 1.9.11, and commit 1abf12f of textpattern (latest commit as of writing this, because 4.5.x isn’t compatible with php 7.x. fun times.)

Last edited by bsaner (2016-03-13 13:42:10)

Offline

#296 2016-03-13 21:53:43

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

bsaner wrote #298233:

i was wondering if it’s possible to make the childen only appear on hover of the parent. i don’t have, and was hoping to avoid, actual pages for the parents as it’s unnecessary/irrelevant for my implementation and would serve to only give an extra load of a page i wouldn’t need and would feel forced/unnatural with the rest of the design. i could disable clicking of the parents, but then of course the children won’t be able to be chosen in the current form… right?

Would the suppress_url=“top” attribute setting help?

Or if you really don’t want to add sections that aren’t required, try the v1.4 beta and experiment with virtual sections.

At the basic level, all items in the menu are really meant to be clickable links but I understand the “issue” with parents. Perhaps you could redirect the parent to the first child? Or maybe a clone might be an option?

also, is it possible to display the list of children vertically instead of horizontally?

This is a CSS question with a sizeable & complex answer, so try Googling “CSS horizontal dropdown menu” for some ideas.

Offline

#297 2016-03-13 22:40:43

bsaner
Member
Registered: 2011-04-11
Posts: 11

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Adi-

thanks so much for your response! i don’t want to seem ungrateful; i can tell a lot of hard work went into this.

i’ve tried with virtual sections as the parent- however, they don’t (of course) expand the children on clicking (unless they’re mapped to an actual page- it’d be nice if one could just map a virtual section to “null” or something that would only open its children), even with clones. i’ve also tried the suppress_url=“top” attribute, but this also renders trying to expand to the children non-functional (which i think i suspected it would). unless i’m doing this absolutely incorrectly or something, whiich i’m almost positive is the case. perhaps this is an issue with 4.6.x branch since i’m using the latest commit? i’m not sure what the behaviour is like comparatively on 4.5.x; i can set up a 4.5 instance locally and compare behaviour.

i’m not entirely sure i can do what i’m hoping to, so i may just say design be foresaken and i’ll just create pages for the parent.

This is a CSS question with a sizeable & complex answer, so try Googling “CSS horizontal dropdown menu” for some ideas.

ah; i was hoping there’d be a breaktag= or the like for the actual menu or something.. though i’m not sure if that’d even help. (like i said, i’m more or less clueless with frontend things, so i apologize again if this is a silly inquiry.)

Last edited by bsaner (2016-03-13 22:42:18)

Offline

#298 2016-03-14 02:41:18

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

bsaner wrote #298243:

… however, they don’t (of course) expand the children on clicking …

You’ve lost me. The “dropdown” or “expand” functionality comes from CSS or maybe jQuery/Javascript. adi_menu just generates the HTML markup – it’s not a widget.

Offline

#299 2016-03-14 03:46:44

bsaner
Member
Registered: 2011-04-11
Posts: 11

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

aaaand now i’m unlost. i’m an idiot. sorry for the confusion! i thought that was part of the way they were generated rather than something in the styling! :X

Offline

#300 2016-09-15 20:45:36

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Here’s a beta version that should be suitable for TXP 4.6

Offline

Board footer

Powered by FluxBB