Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2020-10-24 09:29:13

Bruce Bowden
Member
From: Melbourne, Australia
Registered: 2020-10-22
Posts: 15

Re: Adding file links to articles

Hi guys,
I have been looking at smd_tags and it ‘almost’ does what I want straight out of the box. An example of what I want to achieve: We meet 4 times a year and each meeting generates a number of files.
I created identical lists of tags for both articles and files:
2020, 2019, 2018, March, June, September, December
The article for the June 2020 meeting is tagged ‘June, 2020’ and it’s related files tagged the same.

Unfortunately, smd_related_tags, as you know, gives me all the files with either ‘2020’ or ‘June’, not just files with both ‘June’ and ‘2020’.

I can see in the plug-in admin panel that somewhere I can use AND but can’t work out how to use the power of smd_tags to do what I need.

I had a quick look at the help file for com_article_image but at this stage, tags look to be the fastest way to set up the site.

Thanks in advance for any suggestions.

Stay safe
Bruce

ps, I’m glad in Australia. Our state, Victoria, had 750 cases a day in July, same as the UK at the time. Our current 14 day average is only 5 cases a day. The lockdown has been harsh but almost everyone stuck with it and now we can reap the rewards.

Offline

#12 2020-10-24 09:41:43

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,832
Website

Re: Adding file links to articles

If you want to use smd_tags, look at the tag preferences. The URL management allows you to filter in the URL by using combinators. By default, for example:

example.org/tags/article/june+2020 = articles containing BOTH tags
example.org/tags/article/june|2020 = articles containing EITHER tag

In terms of building the URLs by allowing people to click to add/subtract tags, that’s more tricky. I’ve never done it, but it should be possible with a form that auto-submits when you change selections. Display all the tags in a list with checkboxes alongside each. When submitted, check the form submission and then just concatenate all the selected options with ‘+’ between them and tack them onto the base URL (which you can get from <txp:page_url />).

If there’s nothing submitted, you can set the URL to the base page. And if you wanted to be really fancy you could add an option to the form to allow people to choose between ‘all’ and ‘any’ term, adjusting your separator accordingly.

Hope that helps.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Online

#13 2020-10-24 20:51:23

Bruce Bowden
Member
From: Melbourne, Australia
Registered: 2020-10-22
Posts: 15

Re: Adding file links to articles

I may not have been clear in what I was trying to achieve. I just need a list of files where the file tags match both (all?) the article tags.

Basically I need <txp:smd_related_tags type=“file”>, but showing only files that have all tags in common with the article, not just any tag.

I’m not sure how the URL management code you described can achieve this.

Stay safe
Bruce

Offline

#14 2020-10-25 08:35:39

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,349
Website

Re: Adding file links to articles

Hi Bruce, it is still unclear to me as to what you are trying to achieve, so here come some questions.

  1. Are you trying to include download links to your files in your articles?
  2. Is each meeting documented by one article and many files?
  3. Is each meeting documented by more than one article and many files?
  4. Do you have another section or article where those file lists need to be generated and downloaded from?

Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#15 2020-10-25 08:59:49

Bruce Bowden
Member
From: Melbourne, Australia
Registered: 2020-10-22
Posts: 15

Re: Adding file links to articles

Hi Yiannis and Stef,
Don’t worry too much about this. I think I am trying to run before I can walk. You guys have offered workable solutions. I will use those and get on with learning more about Textpattern.

To answer Yiannis’ questions: Each meeting is a single article with multiple files. I am looking for the easiest way to manage it as there is a bit of historical stuff to upload. Loading all the files through the admin screens, then assigning a couple of tags to each one, is very quick and would be a nice way to manage it but probably overly optimistic at my level of skill.

First step for me now should be finishing all the other parts of the design process, then I can come back armed with a bit of actual knowledge.

I’ll document any eventual solution here in case it’s more than just a strange edge case.

Stay safe
Bruce

Offline

#16 2020-10-25 10:19:44

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,832
Website

Re: Adding file links to articles

Sorry for misinterpreting your requirements. Since smd_related_tags is generally designed for lists that are driven from tags in the URL, it isn’t wired to directly handle tag logic from article content.

It might be possible to add an attribute that could switch between any/all tag matches when cross-matching. Not sure how that would work if it was used in a URL context as well. Will need to give it some thought.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Online

Board footer

Powered by FluxBB