Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-02-13 03:32:16

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Ask-A-Dev : subsections? likely?

Every month or so I have a go at creating a three-level navigation… some content-rich sites demand such a thing, it’s not an idle desire. To use an example that recently made the forum, a travel site that allows for viewing lists like

  • /africa
  • /africa/morocco

where you’d have an individual article like /africa/morocco/drum-ecstacy

  • section/title is almost enough, but not quite
  • section/?category= requires too much twister to get menus & links to include the relevent section, and URLs are not clean

I guess that subsections are the answer but have no idea how complex to integrate from the developers’ POV – without asking for a date, is it on the mudmap, back of the serviette or beer coaster? what sort of priority does it have?

would be happy to allocate some time to mocking up admin screens, thinking thru usage scenarios, if this can assist

Offline

#2 2006-02-13 03:51:53

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: Ask-A-Dev : subsections? likely?

Nardo, and/or developers,
I’ve enjoyed “trying” to play a part in the “Rights and Permissions workgroup” alongside some REALLY smart folks over there, and it I know for us it really helped to have ZEM start us with an assignment.

Is that something you all would be willing to do here? Let people like Nardo and I know what kinds of things need to be mocked up and/or tested for something like this to happen?

Thanks for all your hard work,
(knowing that you do it for yourselves too, but needing you to know it makes people like me really happy and excited to see new functionality / security / etc.)

Cheers,

Matthew


Offline

#3 2006-02-13 06:35:13

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: Ask-A-Dev : subsections? likely?

zem added some stubs for nested sections yesteryear.

Offline

#4 2006-02-14 01:27:42

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: Ask-A-Dev : subsections? likely?

Given that ‘sections’ are mature and stable, here follows an outline of how ‘subsections’ might work, based on previous art.

We assume that the article tag works as it does now, by parsing the URL and outputting lists or individual articles in a context-sensitive manner. And that the category URLs remain the same (?c=), so as to be distinct.

Each section & subsection must have a unique name. Subsections are tied to one section only.

PRESENTATION/SECTIONS TAB

An additional pulldown, labelled parent, is provided. Subsections can be assigned pages just like sections.

CONTENT/WRITE TAB

Pulldown menu lists subsections indented against their parent.

CURRENT TAGS

  • txp:article – new attribute subsections="1" to also grab articles from children of currently viewed section
  • txp:article_custom – attribute section="" can include ‘subsection’ names, plus new attribute subsections="1" to grab articles from children of named sections as well
  • txp:breadcrumb to append subsection title
  • txp:if_article_section and txp:if_section – attribute name="" can include ‘subsection’ names, plus new attribute subsections="1" to allow conditional to pick up children of section
  • txp:section – attributes link="1" and name="" build URL with parent section if one exists
  • txp:section_list – new attribute showchildren="1" with wraptag/breaktag inherited from parent and nested within parent breaktag?

NEW TAGS

  • txp:subsection_list – context-sensitive by default, with parent="" attribute as option for custom list
  • txp:if_subsection – conditional that by default just checks if you’re in a subsection, but also has name attribute

IN PRACTICE

You’ve created a subsection MOROCCO with parent AFRICA. Articles assigned to section AFRICA are presented as an article list at “/africa”. Articles assigned to section MOROCCO are presented as an article list at “/africa/morocco”.

But you also want to show some custom lists…

On your “/africa” page, you want to list your subsections (countries):
<txp:subsection_list label="countries" break="li" wraptag="ul" />

On your “/africa” page, you want to list the 10 most recent stories:
<txp:article subsections="1" form="recent-stories" />

On your “/africa” page, you want to list all subsections (countries) along with all their articles:
<txp:article subsections="1" limit="999" form="index" />
and here’s the article form “index”:
<txp:if_different><txp:section title="1" /></txp:if_different><txp:permalink><txp:title /></txp:permalink>

on your home page, you want to show 10 most recent stories from all country sections:
<txp:article_custom section="africa,europe,asia,oceania,americas" subsections="1" status="live" />

ISSUES

  • use of word ‘subsection’ in tags? maybe inconsistent above
  • need 3 way switch for showing custom lists… proposed attribute above (subsections="1") only allows first two:
  1. show all articles in a section and its children
  2. show all articles in a section but not from its children
  3. show all articles in a section’s children but not in the section itself

Last edited by nardo (2006-02-14 01:32:25)

Offline

#5 2006-02-14 02:38:19

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: Ask-A-Dev : subsections? likely?

Nardo,
I really like how you’re thinking up there.

what do you see subsections looking like in the admin side of things? I’ve often thought of sort of a tabbed tree structure not disimilar to what sections currently look/function like,
  • select by default (yes) (no)
  • show on front (yes) (no)
  • include in search (yes) (no)
  • syndicate (yes) (no)
  • etc

(but “tabbed” / Shifted right to show their “subsection status?”)

Or

(would they have a drop down menu for you to choose which parent they belong to?)

What about pages?

Just curious?

Matthew


Offline

#6 2006-02-14 23:04:19

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: Ask-A-Dev : subsections? likely?

matthew, I figured all that was required was a pulldown called ‘parent’ –

subsections can have all the options available to sections (including associated page template, selected by default, show on front, include in search, syndicate, etc)

I guess the only visual clue to subsection status would then be the pulldown populated with a parent name…

but I understand this screen is likely to be different in the next release, so perhaps subsections could be visually differentiated by an indent or lighter font colour

(I just wanted to see what issues would come up from a user/site administrator point of view, if subsections were introduced – looking forward to other comments, views and use-case scenarios … )

Offline

#7 2006-02-14 23:57:59

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Ask-A-Dev : subsections? likely?

I think it’d be less confusing if the term “subsection” was dropped. All sections are sub-sections, really – the main sections are children of the root/default/top.

<txp:if_subsection> could be replaced by <txp:if_section parent="blah"> or <txp:if_section depth="2"> or <txp:if_section parent="!top">.

<txp:article subsection="1" /> could be <txp:article recurse="1" />. “show on front page” might need to change to a setting that controls whether or not articles in that section are included in a parent section when recurse="1" is used. That setting could be confusing though – is it necessary at all if recurse="1" is used?

show all articles in a section’s children but not in the section itself

I think this would be more confusing than helpful.


Alex

Offline

#8 2006-02-15 06:09:26

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: Ask-A-Dev : subsections? likely?

thanks zem – I agree ‘subsection’ should be dropped, and depth or parent used (depth maybe better)

I’m not familiar with ‘recurse’ or ‘recursive’ – but I looked it up and it seems precise

re: home page

I don’t think that’s difficult, you simply set whether that section appears on the home page, and that’s that… if a depth 1 section is set to show on home page, by default it only shows articles in that section at that level… you switch on the child’s setting if you also want it on the home page

re: three way switch (is it necessary at all if recurse="1" is used?)

I can’t come up with a use-case

actually I was thinking more about those sort of navigation lists which would show

  • at /section -> a list of subsections
  • at /section/subsection -> an expanded list that showed the articles in the subsection under the relevant subsection title

for a dynamic-static site…
but that might be a section_list kinda thing

but just for the sake of it… changing that attribute to depth:

  1. you’re in a section (depth=“1”) and want to list articles from depth=“1” only: you use txp:article
  2. you’re in a section (depth=“1”) and want to list articles from depth=“2” only: you use txp:article depth="2"
  3. you’re in a section (depth=“1”) and want to list articles from depth=“1,2”: you use txp:article depth="1,2"
  1. you’re in a section (depth=“2”) and want to list articles from depth=“2” only: you use txp:article
  2. you’re in a section (depth=“2”) and want to list articles from depth=“1” only: you use txp:article depth="1"
  3. you’re in a section (depth=“2”) and want to list articles from depth=“1,2”: you use txp:article depth="1,2"

why? will think about it some more

Offline

#9 2006-02-15 14:22:41

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: Ask-A-Dev : subsections? likely?

Nardo,

I am really tracking with how you are structuring the article scheme.
I follow on letting the “subsection” naming go and using “depth” as a more versatile tool.

Zem,

What are the questions that need to get worked out from a “non-developer” standpoint?


Offline

#10 2006-02-15 22:59:16

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Ask-A-Dev : subsections? likely?

I don’t think that’s difficult, you simply set whether that section appears on the home page, and that’s that… if a depth 1 section is set to show on home page, by default it only shows articles in that section at that level… you switch on the child’s setting if you also want it on the home page

What about when there are multiple levels, home/A/B? “show on home page” seems awkward: B articles would be shown on home, but not on page A. “show on parent pages” is more general and probably less confusing. recurse=1 could be the default, it would show articles from the current section and all child sections that have “show on parent pages” set. <txp:article recurse=0 /> would show articles from the current section only. (there’s probably a better word than “recurse”)

depth might be useful as an advanced feature for unusual situations, but I think we need more verbose and obvious methods for the most common scenarios.


Alex

Offline

#11 2006-02-15 23:03:41

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Ask-A-Dev : subsections? likely?

What are the questions that need to get worked out from a “non-developer” standpoint?

What else does this affect? Feeds, special URLs like /rss/ and /author/, search URLs, etc.

It makes sense to allow sections to inherit some settings from their parents. Does this need to be per-setting, or is one “inherit” setting per section enough? (i.e. is it necessary to inherit, say, only the page template setting, while using custom values for the other settings)

How would this affect and relate to themes?

How would nested categories interact with nested sections? That could easily get out of hand.

..etc. Discover potential problems.


Alex

Offline

#12 2006-02-16 01:01:49

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: Ask-A-Dev : subsections? likely?

This looks really promising. I have nothing to add but encouragement.

I’ve worked around the lack of subsections with categories for the most part, but semantically it tends to be a bit in-elegant. And you eventually have to hand-code a nested section/category/category list.

Nardo: I like the way you’ve kept this minimal and straightfoeward and in line with the current TXP behaviour.

Offline

Board footer

Powered by FluxBB