Textpattern CMS support forum

You are not logged in. Register | Login | Help

#21 2019-10-31 20:01:20

etc
Developer
Registered: 2010-11-11
Posts: 3,427
Website

Re: Dev news

michaelkpate wrote #319880:

Here’s an example: Design a blog with permalinks in the format /year/month/day/title. Then add a contact page and an about page by creating sections using /section/title. I used to do that in gpb_permanent_links a lot.

Plugins approach was (and still is) fine, but txp custom fields branch is taking shape, and it will be quite possible for articles from different sections to have different structure (e.g. no title or category at all). So introducing per section permlink mode in core seems justified, though it’s too early for custom modes yet.

Offline

#22 2019-10-31 20:08:57

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,381
Website

Re: Dev news

Hi Michael,
I guess that the latest dev will offer you at least part of what you are describing with the inclusion of categories and sub-categories in the url schema. I agree that we may never have the flexibility of gbp_permanent_links, but we will still have enough flexibility to do what we need, be it in a more manual way. We can for example name sections like 2019, 2020, 2021 etc, then create 12 categories, one of each month and then categories for the days of the months. `Tedious but possibly doable.

My one confusion for now is whereas breadcrumb/title/ will by default pick category_1 and if there will be a semantic role for category_2 within this schema.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

#23 2019-10-31 20:30:49

etc
Developer
Registered: 2010-11-11
Posts: 3,427
Website

Re: Dev news

You can already use year/month/day/title mode in one section, and section/title in another one. Just note that authors, categories etc are not tied to sections, so their permlinks will follow the default format set by the global permlink_mode pref.

colak wrote #319882:

My one confusion for now is whereas breadcrumb/title/ will by default pick category_1 and if there will be a semantic role for category_2 within this schema.

It will pick both and go to the maximal depth. For example, if cats is a descendant subcategory of animals, an article with Category1="animals" and Category2="cats" will have a rather verbose

section/animals/mammals/.../cats/title

permlink. Which also means that just cats would suffice here.

Note that section/category/title mode produces a shorter permlink, skipping intermediate nodes:

section/animals/cats/title

Offline

#24 2019-11-01 01:50:36

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,759
Website

Re: Dev news

Yay! Now that you have started implementing it, I’m actually looking forward to this (esp section/category/title). But…

In debug mode, I get this on the section-edit panel. Not intended I supposed although my cat looked up…

Notice "Undefined variable: sec_permlink_mode"
in /Users/<username>/Sites/_txptest/textpattern/include/txp_section.php at line 524.

textpattern/include/txp_section.php:524 adminErrorHandler()
textpattern/include/txp_section.php:59 section_edit()
textpattern/index.php:261 include()

but then, changing the URL pattern to section_category_title and saving returns an error:

The section was not saved due to an error. Please try again.

Debug message again:

User_Error "Unknown column 'permlink_mode' in 'field list'"
in /Users/<username>/Sites/_txptes/textpattern/lib/txplib_db.php at line 403.

adminErrorHandler()
textpattern/lib/txplib_db.php:403 trigger_error()
textpattern/lib/txplib_db.php:453 safe_query()
textpattern/include/txp_section.php:645 safe_update()
textpattern/include/txp_section.php:59 section_save()
textpattern/index.php:261 include()

When accessing the front end, accessing a section (article list) is OK but an individual article returns a 404, with

General error Notice: Undefined index: development on line 404
textpattern/publish.php:237 preText()
index.php:107 include()

development is the section title for the page in this case.

the (default) URL pattern is section/title

Offline

#25 2019-11-01 08:55:05

etc
Developer
Registered: 2010-11-11
Posts: 3,427
Website

Re: Dev news

Hi Philippe, thanks for testing. Syncing via git does not trigger db update. Try to logout/in or add manually varchar 63 permlink_mode column to txp_sections table.

Offline

#26 2019-11-01 12:13:14

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,759
Website

Re: Dev news

etc wrote #319885:

Hi Philippe, thanks for testing. Syncing via git does not trigger db update. Try to logout/in or add manually varchar 63 permlink_mode column to txp_sections table.

I suspected something like that might be the case. A logout/login didn’t fix or help in any way. I’ll have to try manually adding the column to the table.

(care to remind me of an easy way to do add the column? My MySQL-fu is poorer than ever… Thank you. No hurry I don’t think I’ll have time over the next couple of days.)

The whole thing seemed to work well in a quick test on Pete’s demo site. But that was without the chaos I am used to from more real world content. That is why I like to test with my old test site, full of “articles” and snippets and weirdness.

Offline

#27 2019-11-02 12:51:44

etc
Developer
Registered: 2010-11-11
Posts: 3,427
Website

Re: Dev news

phiw13 wrote #319887:

(care to remind me of an easy way to do add the column? My MySQL-fu is poorer than ever… Thank you. No hurry I don’t think I’ll have time over the next couple of days.)

Probably the easiest way is to include this snippet in some article and visit it:

<txp:php>
define('TXP_UPDATE', true);
include_once(txpath.'/update/_to_4.8.0.php');
</txp:php>

Offline

#28 2019-11-05 02:55:55

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,759
Website

Re: Dev news

etc wrote #319902:

Probably the easiest way is to include this snippet in some article and visit it:

<txp:php>...

Thank you for that. It worked like a charm.

Overall, those additional URL schemes seem to work fine with my chaotic test site. Lovely. One weakness though, which I think you mentioned somewhere above. The view link on the edit panel uses the default URL scheme. But everywhere from the front-end (index page, category pages etc) the correct URL is used.

Offline

#29 2019-11-05 05:56:13

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,759
Website

Re: Dev news

Some nitpicking (maybe?) on the updated section panel. The sections that use the default URL pattern list the type of pattern (e.g section_title) but on the dit panel, it is listed as “Default”, that confused me for a moment.

And also, on the listing panels, those entries are displayed using the .disabled class. that is a bit weird… we have the .footnote and the .txp-form-field-instructions class, but that last one is semantically tied to forms (preferences panels, edit panels) and does actually more that just handle the text string. I guess we might need a more generic class for secondary text… But I‘ll leave that Mr Wareham.

Offline

#30 2019-11-05 18:46:25

etc
Developer
Registered: 2010-11-11
Posts: 3,427
Website

Re: Dev news

phiw13 wrote #319928:

The view link on the edit panel uses the default URL scheme. But everywhere from the front-end (index page, category pages etc) the correct URL is used.

Thanks, will look for a fix.

phiw13 wrote #319930:

The sections that use the default URL pattern list the type of pattern (e.g section_title) but on the dit panel, it is listed as “Default”, that confused me for a moment.

And also, on the listing panels, those entries are displayed using the .disabled class. … I guess we might need a more generic class for secondary text… But I‘ll leave that Mr Wareham.

The technical reason behind it is that default permlink value is empty, which means “use the global permlink_mode pref”. Hence, when sorting sections list by permlink mode column, these sections come first/last. So I needed some visually “blank” but still informative text and have not found anything better than disabled class. +1 for leaving it with Phil :-)

Offline

Board footer

Powered by FluxBB