Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-02-10 20:00:10

Freeant
Member
Registered: 2012-04-16
Posts: 36

How to make a menu

Perhaps, something like <txp:section_list…

Perhaps instead of pages better use also section

Page (or section) – must also be a link to “page or section”

?

Last edited by Freeant (2015-02-10 21:19:51)

Offline

#2 2015-02-10 21:21:24

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: How to make a menu

The problem with that diagram is that sections don’t belong to pages – they use pages for display purposes.

adi_menu might be able to help. It allows for hierarchies within sections for the purposes of building a menu.

Offline

#3 2015-02-10 21:25:05

Freeant
Member
Registered: 2012-04-16
Posts: 36

Re: How to make a menu

Thx aslsw66.

But…
Is it possible to do without plug-ins.
Perhaps instead of pages better use also section

Last edited by Freeant (2015-02-10 21:27:15)

Offline

#4 2015-02-11 04:23:21

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: How to make a menu

Freeant wrote #288160:

Thx aslsw66.

But…
Is it possible to do without plug-ins.
Perhaps instead of pages better use also section

I think so, especially if you don’t get bound up in a hierarchy.

Sections = Equipment, Hardware.
Categories = Drills, Screwdrivers, Nails Bolts, Nuts
Articles = One for each of the Drills, Screwdrivers, Nails Bolts, Nuts

Use Section and Category lists to organise it all as you see fit.

Offline

#5 2015-02-11 08:21:22

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: How to make a menu

The only caveat being that categories don’t uniquely belong to sections.

This shows the importance of careful planning before creating sections and categories. And then careful use to ensure you don’t end up mixing-and-matching in a way that breaks your hierarchy.

Offline

#6 2015-02-11 08:28:55

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,395
Website GitHub Mastodon Twitter

Re: How to make a menu

aslsw66 wrote #288175:

The only caveat being that categories don’t uniquely belong to sections.

This shows the importance of careful planning before creating sections and categories. And then careful use to ensure you don’t end up mixing-and-matching in a way that breaks your hierarchy.

That is very true but you could be having parent categories having the same names as the sections.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#7 2015-02-11 09:23:10

Freeant
Member
Registered: 2012-04-16
Posts: 36

Re: How to make a menu

OK)
Can u show an example of the menu code?

Offline

#8 2015-02-11 12:22:37

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,395
Website GitHub Mastodon Twitter

Re: How to make a menu

txptips has a good example.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#9 2015-02-28 03:45:08

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,277
Website Mastodon

Re: How to make a menu

I find it very confusing that there is all kinds of mentions of subsections or subsection. But there is no such tag or documentation on creating sub-sections.

This tixtip ( (which i’ll make use of ) has mention of sub-menus but not how to create them.

What should we be doing then? Using Categories? Can Categories be tied exclusively to a Section?

thanks.


…. texted postive

Offline

#10 2015-02-28 14:39:06

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,224
Website GitHub

Re: How to make a menu

I find it very confusing that there is all kinds of mentions of subsections or subsection. But there is no such tag or documentation on creating sub-sections.

There’s no mention of sub-sections in this thread (so far), but you’re right, it doesn’t exist in txp.

Can Categories be tied exclusively to a Section?

No. As Anura / aslsw66 mentioned above “categories don’t uniquely belong to sections” but you can voluntarily organise them that way yourself if you want to.

Yiannis also pointed to a potential solution using naming as a way of creating a bridging between sections and categories: if you organise the categories that you want to ‘look like sub-sections’ within a parent category, and name that parent category the same as your section name, you can use txp:category_list and the attribute parent='<txp:section />' to output a list of categories per section, for example when building a menu.


TXP Builders – finely-crafted code, design and txp

Offline

#11 2015-02-28 16:43:24

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,277
Website Mastodon

Re: How to make a menu

@jakob – thanks. that helps get my head around the issue.

But i have seen references to TXP and Subsections and submenus TxpTips listed above. etc. It would be clearer if the just said A Section with Categories

as the thread indicates one has to plan carefully before creating sections and categories


…. texted postive

Offline

#12 2015-02-28 18:02:24

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,224
Website GitHub

Re: How to make a menu

Yes, it’s a topic that comes up repeatedly – though the particular thread you link to is a “features idea” originally proposed over ten years ago(!) so that was imagined functionality not real functionality. It’s also a topic where normal language usage and txp terminology overlap causing additional confusion.

TXP is limited when it comes to sites with deep, nested structures. While this is a limitation, it can also be (construed as) as a virtue as it ensures that sites don’t go overboard with nesting!

Sometimes, though, there are occasions where you need to go one level deeper. In that case you can usually fake it. For the menu with sub-menus, there are lots of methods, some described in this thread or on txptips.com. You still end up with urls that look like this:

www.domain.com/section/
www.domain.com/section/?c=category  <-- sub-level as category
www.domain.com/section/individual-article-title <-- individual article

Often that’s okay, and the individual article url is often okay without the category featuring in it. This thread contains some ideas for making /section/category links look prettier. If you really need something like /section/category/individual-article-title, the only way – as far as I know – is using the plugin gbp_permanent_links which allows you to build custom url-schemes on a per-section basis.


TXP Builders – finely-crafted code, design and txp

Offline

#13 2015-02-28 18:59:43

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: How to make a menu

It seems to me that the initial question is not answered directly, until now. Or is that wrong?

I don’t know what freaant meant by “pages”. In the given example, “equipment” and “hardware” could be sections and “Drills, Screwdriver, Nails, Bolts” etc. articles. In such a case, the navigation would be formed from the sections with lists of articles.

Last edited by GugUser (2015-02-28 19:00:56)

Offline

#14 2015-03-01 17:49:10

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,277
Website Mastodon

Re: How to make a menu

Well i am again confused.

I am using the Default Section that is auto-created for us on install.

Its the root index.php page or simply mysite.net/

I was trying to implement a menu with an active class
Like this:

<li<txp:if_section name="default"> class="current-menu-item"</txp:if_section>>
    <txp:section link="1" title="1" name="Home" />
  </li>  

But if i use name=“Home”“ it won’t work , it only works if i use name=“default”“

but then the url looks like this http://mysite.net/default/ not ideal nor wanted

but this works:

<li><a href="http://mysite.net" title="Fresh Sites">Home |</a></li>

I then created a page Home using the same Page and Form as what Default uses.

But then i end up with a URL of http://mysite.net/home/ and no content is output! even if there was output i don’t want /home/ in url

How do use default landing page with or without a title but have this url i.e. http://mysite.net/

PS on this page last example

<li<txp:if_section name=",article"> class="active"</txp:if_section>>
    <txp:section link="1" title="1" name="" />
  </li>

is it correct or is there a typo? why “,article” if i use that and leave name blank “ “ nothing happens


…. texted postive

Offline

#15 2015-03-02 03:20:18

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: How to make a menu

I never work with the default pages and forms. So I can’t aswer yor question in this sence.

But, I can show you how I made a simple and basic sections navigation.

Important: The section “home” must exist and “Section appears on front page?” for this section must be set to “Yes”.

Form “nav”:

<nav>
<ul>
<txp:if_status><li<txp:if_section name=","> class="current"><span><txp:section name="home" title="1" /></span><txp:else />><a href="/"><txp:section name="home" title="1" /></a></txp:if_section></li><txp:else /><li><a href="/"><txp:section name="home" title="1" /></a></li></txp:if_status>
<txp:section_list sections="section-1, section-2, etc" break="" form="nav-sections" />
</ul>
</nav>

Form “nav-sections”:

<li<txp:if_section name='<txp:section />'> class="current"><span><txp:section title="1" /></span><txp:else />><a href="/<txp:section />"><txp:section title="1" /></a></txp:if_section></li>

This is my solution, there are others, this is not the only way.

For a better understanding, you can break up the long lines.

Offline

Board footer

Powered by FluxBB