Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#313 2015-06-29 17:34:44

mmelon
Member
Registered: 2006-03-02
Posts: 95

Re: smd_tags: unlimited article, image, file and link taxonomy

Hi stef,

I guessed as much. Removing smd tag list did indeed give me one result as expected. However in my experience today, appending non existent cats like /blah to the end, still returned the article. I think either the AND was working as an OR, or it was only evaluating the first cat. I will try again tonight.

Mike

Offline

#314 2015-06-29 18:12:22

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: smd_tags: unlimited article, image, file and link taxonomy

mmelon wrote #292284:

appending non existent cats like /blah to the end, still returned the article.

It will. Any bogus tags are just ignored, so you could type:

example.org/smd_tags/tag1/ate/my/shorts/tag2/stole/my/badger

and it’d pull out articles that contained tag1 and tag2.

For the vaguely interested, internally the plugin constructs an array of matching tags from the URL, keeping a record of their IDs. Anything it doesn’t recognise as a tag will not get put in the array, so when it comes time to render the tags, it only “sees” real tags and compares them to your content.

I thought that was a handy feature. Perhaps not!


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

Offline

#315 2015-06-29 18:54:17

mmelon
Member
Registered: 2006-03-02
Posts: 95

Re: smd_tags: unlimited article, image, file and link taxonomy

No that’s all good. I will crack on with my filter search page project. Thanks for the help. Again!

Offline

#316 2015-06-29 20:16:45

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: smd_tags: unlimited article, image, file and link taxonomy

mmelon wrote #292294:

I will crack on with my filter search page project.

Cool. When you get it going (or during the process), please would you mind sharing how you did it? I’ve only partially tried it, with a view towards adding some tags to the plugin to make it easier to wrangle the URLs. So if you end up with any licks of PHP or a suite of plugins to achieve the goal of adding and removing tags, I’d love to see if I can help smooth the process with a bit of code.

Being able to combine tags for filtering is arguably one of the unique selling points of the plugin so anything I can do to pimp that side of things, I’ll consider. Even if it’s just writing your experience up as an example in the documentation, it’ll be a massive boon. Thanks.


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

Offline

#317 2015-07-02 14:28:21

mmelon
Member
Registered: 2006-03-02
Posts: 95

Re: smd_tags: unlimited article, image, file and link taxonomy

Hi,

For those that might be interested. I’ve spent a few days on this now but whilst I am close, I haven’t been able to get the behaviour I want. What I was hoping for was like this:

https://www.workwearexpress.com/polo-shirts/
(in terms of user experience with the mouse. Not in url structure or behaviour)

  • Every product has different filter criteria depending on what it is tagged with.
  • You can make one selection from each filter section. So one colour from colours, one size from size etc.
  • The results narrow as you choose. Every filter results in a matching product. If a filter selection would result in zero results, when added to the current search criteria, then that filter item or section is removed.

I set up my tags like this

product category - root
    filter section name - level 1
      filter item - level 2

..giving something like

polo-shirts
—brand
——fruit-of-the-loom
——jerzees
——kustom-kit
—colour
——red
——blue
——green
—size
——xs
——s
——m
——l
——xl
——xxl
etc..

I setup a section called ‘catalogue’ to use a new page template. In the smd_tags prefs, I setup ‘filter’ as a trigger word.

I tagged a few test articles/products in the catalogue section.

I setup a page template with the code below.

If you do this, hopefuly visiting:

/catalogue/filter/article/[anytag]

(i get an error if i don’t supply a starting tag)

you see it working. It returns matching articles at the top, gives you a list of removable selected criteria underneath, and finally the remaining tags to filter on at the bottom.

I think it works and I may still develop and use it. The biggest frustration is with the line <!— if this tag is used on any articles/products. Need to finesse this. —>. The problem is it allows you to choose filter criteria that will result in zero matches. I am using smd_if to test if that tag appears in any articles. What I really want is to say: only output the link as a filter criteria if calling smd_related_tags on this new url context, will result in one or more matching articles.

I think one way to achieve this might be to supply a url context to one of the containers. perhaps

/ = AND combinator

<txp:smd_tag_list urlcontext="cat1/cat4/cat2">
   <txp:smd_related_tags/>

I suppose the only purpose overriding the actual current url context serves, is to allow a test to see if an additional tag will produce related articles.

Anyway, I might continue and use this or I might rethink. Thanks for reading.

template code:

<txp:smd_if_tag>

    <!-- get the articles from the current section that match the tags in the current url -->

	<txp:smd_related_tags match="tag_name"  wraptag="ul" break="li" />

	selected tags:

	<txp:smd_tag_list type="article"  flavour="list" > <!-- loop through all of the tags in the url -->

		<txp:variable name="toRemove">/<txp:smd_tag_name title="0"  /></txp:variable> <!-- store in $toRemove the text for each piece of the url e.g '/cat1' -->

		<!-- remove the above from the current url. this gives us the url that returns the results after the current cat is removed -->

		<txp:variable name="withLinkRemoved"> 

			<txp:php> 

				global $variable;

				$currentUrl = $_SERVER['REDIRECT_URL'];

				$newUrl = str_replace($variable['toRemove'], "", $currentUrl);

				echo $newUrl;

			</txp:php>

		</txp:variable>

		<txp:smd_tag_name title="0"  /> <a href='<txp:variable name="withLinkRemoved"/>'>[x]</a> <!-- output each url title with a little a tag to remove it -->

	</txp:smd_tag_list>

	<!-- make a comma seperated list of the parent categories of each category in the url. The idea here is when you select a category/filter from the filter menu, all other options at the same sublevel are removed. You drill down through the results by making one choice from each criteria.  -->

	<txp:variable name="exclude"><txp:smd_tag_list wraptag="" type="article" showall="0" flavour="list" break=","><txp:smd_tag_info item="parent"/></txp:smd_tag_list></txp:variable>

	<!-- Generate a list of all relevant categories to filter on -->

	filter on:<br/>

	<txp:smd_tag_list  parent="0" flavour="list" wraptag="div" type="article" showall="1"  break=""> <!-- I seem to have to use showall to get the full tag hierarchy -->

		<txp:smd_if field='<txp:smd_tag_info item="parent"/>' operator="notin" value='txpvar:exclude' list_delim=","> <!-- if the parent of this tag is not in the exclude list above, we can use it as this criteria has not been used yet -->

			<txp:smd_if field='<txp:smd_tag_info item="level"/>' operator="eq" value="1"> <!-- my level 1 tags are used as descriptions. We don't output a link -->

					<div class="description"><txp:smd_tag_name title="0"  /> </div>

			<txp:else />

				<txp:smd_if field='<txp:smd_tag_count wrapcount="" />' operator="gt" value="0"> <!-- if this tag is used on any articles/products. Need to finesse this. -->

					<!-- this is the url that adds this filter to the current url chain -->

					<txp:variable name="newUrl">

						<txp:php>echo $_SERVER['REDIRECT_URL'];</txp:php>/<txp:smd_tag_name title="0"  /> 

					</txp:variable>

					<div><a href='<txp:variable name="newUrl"/>'><txp:smd_tag_name title="1"  /></a></div> <!-- output the next available filter -->

				</txp:smd_if>

			</txp:smd_if>

		</txp:smd_if>

	</txp:smd_tag_list>

</txp:smd_if_tag>

Kind regards,
Mike

Last edited by mmelon (2015-07-02 14:30:10)

Offline

#318 2015-07-06 15:27:08

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: smd_tags: unlimited article, image, file and link taxonomy

Hi,
I’ve got some weird problem with smd_related_tags.
I want to sort the list by “Title asc”, but if I try the results will be empty.
The tag works fine without any sort-Attribute, as well as with sort=“Posted desc” and sort=“Posted asc”
but it refuses sort=“Title asc”. (“title asc” the same)

Offline

#319 2015-07-08 05:39:26

mmelon
Member
Registered: 2006-03-02
Posts: 95

Re: smd_tags: unlimited article, image, file and link taxonomy

Hi Stef,

Thinking more about using smd_tags as a filter search, a previous employer used to offer one as an upgrade on their ecommerce platform. Essentially it would need to look at the related tag items (the results) and produce a structured list of all unique tags on the results not yet selected. It’s this unique criteria list that you use to drill through only criteria combinations with results.

Undoubtably massive work. I’m currently thinking I might be able to do something with ajax. Like output them hidden then test for results and switch back on those that have them.

Kind regards,
Mike

Offline

#320 2015-07-13 13:12:15

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: smd_tags: unlimited article, image, file and link taxonomy

Hi.

there is a way to print a tag name getting by url?

becose <txp:smd_tag_name title="1" /> into a page width this url index.php?s=articoli&smd_tag=lindo&smd_tagtype=article print nothing.

thankyou

Offline

#321 2015-07-14 06:20:26

mmelon
Member
Registered: 2006-03-02
Posts: 95

Re: smd_tags: unlimited article, image, file and link taxonomy

Hi, can I just confirm that by whatever method (extra plugins etc), it is possible to page the results from related tags?

Thank,
Mike

Offline

#322 2015-08-29 12:44:18

jpdupont
Member
Registered: 2004-10-01
Posts: 752

Re: smd_tags: unlimited article, image, file and link taxonomy

Hello Stef,

impossible to install the smd_tag tables with the actual 4.6 dev TXP

mysqli_… ?

Offline

#323 2016-04-11 01:33:59

giz
Member
From: New Zealand
Registered: 2004-07-26
Posts: 304
Website GitHub Twitter

Re: smd_tags: unlimited article, image, file and link taxonomy

I have a list of article tags:

Tag 1
Title: Woodline
Name: woodline-basin
Linked cat: Basins
Tag 2
Title: Woodline
Name: woodline-bath
Linked cat: Baths
Tag 3
Title: Woodline
Name: woodline-accessory
Linked cat: Accessories

and some articles:

Article 1
Tag: woodline-basin
Article 2
Tag: woodline-bath
Article 3
Tag: woodline-accessory

In an article form, I have:

<txp:smd_related_tags match="tag_title" /> // simplified for brevity

When viewing (say) Article 1, I expect to see Article 2 and Article 3 listed in my output as they share the same Title of Woodline, but smd_tags returns nothing.

Am I missing something, or misinterpreting how to use match="tag_title" in smd_related_tags?

Thanks.

Offline

#324 2016-04-18 00:08:14

lazlo
Member
Registered: 2004-02-24
Posts: 110

Re: smd_tags: unlimited article, image, file and link taxonomy

When I install I do not see these mentioned buttons:

Remove prefs †
Remove tables †
Rebuild tags †

and when I try import from rss_unlimited_categories nothing happens.

Do I have a java script problem? And how can I track that down?

Thanks

Offline

Board footer

Powered by FluxBB