Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2008-10-17 07:42:09

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

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

Some thoughts about css inside plugin – if you mean how2 seaprate css and plugin code (code that is avaible when clicking edit link in admin) you can:

  • output css to mysql
    • if rvm_css is active and tuned (directory with 777 right sexists) css could be moved to file – it will save some time for mysql query :)
  • base64encode and zip code and enter it in the end of plugin code – this will reduse size and the ability for human to read css :)

Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#17 2008-10-17 08:28:55

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,440
Website GitHub

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

the_ghost wrote:

output css to mysql

That’s not a bad idea. During installation I could simply write a new Stylesheet called smd_tags (if it doesn’t already exist) to the database and then call it from the code. I suppose I could also detect if the rvm_css plugin is installed and use that as the load mechanism, though I don’t know what would happen if you forgot to visit the Stylesheet tab, view the smd_tag sheet and have it create the file in the directory. Perhaps if the file is not available, rvm_css will default to loading it the old way… I’ll check the code.

It’s certainly something to think about; thanks for the tip. I wonder if I could make it an optional tick box under the Install tables button… and perhaps a similar tick box when removing tables so you can choose whether to leave the stylesheet alone.


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#18 2008-10-17 09:07:04

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

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

You totally and even more understood what i meant :) I didn’t think over txp’s stylesheets – i thought over using some table\row in mysql for storing css, but using stylesheets tab is brilliant idea, how could i miss it? :)


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#19 2008-10-17 11:40:00

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,676
GitHub Twitter

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

Stef. What another amazing plugin!

How many did you still create?

Seems obvious you could become a Core Developper. Did you ever thought about this eventuality?

Cheers,


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#20 2008-10-17 12:47:52

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,440
Website GitHub

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

Pat64 wrote:

another amazing plugin!

Thanks. Hope it’s useful for you. If you spot anything odd or have some ideas to make it better, don’t hesitate to let me know.

How many did you still create?

15 so far (plus a couple of unreleased/unfinished ones) and I’m sure there are plenty more ideas that’ll come my way in future…

Seems obvious you could become a Core Developper. Did you ever thought about this eventuality?

Ha ha ha! Thanks for the vote of confidence but I don’t have the right mindset for it. I’m a self-taught hacker with only fractional knowledge of the inner workings of TXP, not a cool, calculated coding machine like wet, ruud, all the previous devs, and many other plugin authors who I stand in awe of (net-carver, jm, variaas, rloaderro, graeme, manfre, gocom, truist, wilshire, cbeyls, chriloi, pepebe, gerhard, trenc, igner, to name just a few). They’d all be in line ahead of me, imho.

To be a dev you need to have a vision of where the product is going, vision of what has gone before, know the reasons certain decisions have been made in the past, be awesome at coding and even better at testing. And, crucially, to be able to say ‘no’ when something doesn’t fit with the TXP ethos. I’m too much of a throw-it-together ‘yes man’ and just do things off the cuff because I can, and have this excellent CMS at my disposal.

I luckily (and randomly) dropped into the awesome TXP community, shook it about with some fortunate coding opportunities and have found my niche. Tentative patch submission is my current limit :-)

Last edited by Bloke (2008-10-17 12:49:46)


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#21 2008-10-17 15:01:02

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

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

Thanks Stef. Changes made to code and all seems to work as expected.

I’ll go and work on that CSS now.

I haven’t tried anything on the client-side yet due to the currently needed hack. I’ll get around to it eventually.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#22 2008-10-17 15:05:45

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,440
Website GitHub

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

thebombsite wrote:

Changes made to code and all seems to work as expected.

Ace.

I’ll go and work on that CSS now.

Ace ^2.

I haven’t tried anything on the client-side yet due to the currently needed hack.

OK, no probs. The hack is only for images. And in fact only if you want to run the smd_related_tags or smd_tag_list from_within_ an images form, which you currently can’t do due to lack of the $thisimage context.

I put together another patch last night with a heavily reduced tag set (6 tags compared to, like 17 in the 1st submission!) and I’m running it through some testing to see if it allows all of the functionality people might require. Hopefully should be submitted for approval/further testing over the weekend if I get some time.


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#23 2008-10-17 15:12:06

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

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

OK. Let me know when it’s ready and I’ll give it a whirl. Forgot it only applied to certain image tags. :(

And when you have some spare time don’t forget to move that site of yours into a decent CMS. :)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#24 2008-10-17 15:33:00

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

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

Hey, while you’re at it… ;) how about a global category for all content types.

That would totally simplify the set up for the client section detailed here.

Seriously though… outstanding work, cholo.

Offline

#25 2008-10-17 15:41:26

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,440
Website GitHub

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

mrdale wrote:

Hey, while you’re at it… ;) how about a global category for all content types.

Welcome to xPattern :-)

EDIT: Actually, that might be doable. Hmmm…. *stef dons his deviant coder's hat*

Last edited by Bloke (2008-10-17 15:44:18)


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#26 2008-10-17 16:23:47

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

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

BTW: I realize that every time you release something brilliant, I immediately say “Oh hay. Can haz X and Y?”

Offline

#27 2009-01-11 19:12:11

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

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

Howdy!

I’m testing the smd_related_tags tag, and I keep getting the following errors:

Notice: Undefined variable: uLastMod  on line 906
Notice: Undefined variable: uExpires  on line 929

Here’s the tag generating the error:

<txp:smd_related_tags type="article" section='<txp:section />' label="Possibly related" labeltag="h3" wraptag="ul" break="li" />

I get the same errors if I add match="keywords" attribute.

Did I do something wrong in the setup phase? I’m running TXP 4.0.7 with MySQL 5.0.41.

Offline

#28 2009-01-11 19:52:04

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

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

I think I found the solution— thanks, Stef!

I edited the client-side plugin, replacing uPosted with uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod all the way, and the error messages went away. Hopefully this is a healthy, wholesome solution that won’t destroy me down the road. ;)

Offline

#29 2009-01-12 02:43:31

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

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

from Admin help:

Default section for tags : Any links from the client-side tags will be sent to this section for display. Can be overridden on a tag-by-tag basis with the section_link attribute.

This sounds like the smd_tags analogue to <txp:tru_tags_handler />, but I can’t figure out how to configure out how to configure a landing page for tag links.

With tru_tags, my setup worked like this:

<txp:if_section name="tags">
	<txp:tru_tags_handler />
	<txp:else />
	// content //
</txp:if_section>

What’s the proper way to setup smd_tags’s default section? I’ve tried something akin to this:

<txp:if_section name="tags">
	<txp:smd_tag_???>
			<h3><txp:title /></h3>
			<txp:rss_auto_excerpt paragraphs="1" />
	</txp:smd_tag_???>
	<txp:else />
	// content //
</txp:if_section>

smd_if_tag_list

Conditional tag that returns true if the current scope is a global tag list. Useful for detecting if a tag has been clicked and redirected to a landing page so you can take some action on that page.

From this snippet, I thought smd_if_tag_list was the tag to use here, but I haven’t found the correct way to get it working.

I would be grateful for any guidance offered on this! Thanks!

Last edited by johnstephens (2009-01-12 02:47:39)

Offline

#30 2009-01-15 00:22:04

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,440
Website GitHub

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

johnstephens wrote:

What’s the proper way to setup smd_tags’s default section?

Hi John, sorry for the delay in getting back to you. The main difference between smd_tags and tru_tags in this regard is that you do not need a handler in smd_tags. It is automatic.

First of all, go to the plugin prefs and make sure you set up the name of a section to be your landing page. You can leave URL name parameter and URL type parameter alone for now.

Let’s say you chose smd_tags as your default page. Create a section smd_tags and assign it a Page. It could be the same Page as you already use; in which case you need to use the conditional <txp:smd_if_tag_list>... your tag shenanigans...</txp:smd_if tag_list> to separate it from your regular content. If this is a dedicated page template in a dedicated section you don’t need to use the conditional tag, though it’s probably good practice.

OK, so inside your conditional you might put something like this:

<h2>Tags list</h2>
<txp:smd_tag_list>
  <txp:smd_tag_name title="1" link="1" />
  <txp:smd_tag_count />
  <txp:smd_related_tags wraptag="ul" break="li">
    <txp:smd_if_tag type="file">
       <txp:file_download_link><txp:file_download_description /></txp:file_download_link>
    </txp:smd_if_tag>
  </txp:smd_related_tags>
</txp:smd_tag_list>

Phew! That uses <txp:smd_tag_list /> as a container and outputs all tags of the given type. It shows the tag name and its article count, then it goes away and looks for all related tags that share the current (article) tag name. It assembles a complete list of those behind its back and the conditional <txp:smd_if_tag type="file"> takes a look at each one. If it is a tag associated with a file, it displays the download description of that file. If it’s a tag of any other type (link, image, article) it ignores it.

That’s all well and good but how do you give it a starting point? That’s where the URL comes in:

site.com/smd_tags/article

will show all article tags and — if they share any tags with files — will show those too as a list.

site.com/smd_tags/file

will show all file tags and — if they share any tags with other files — will show those too as a list. And so on.

site.com/smd_tags/article/tiger

will show the article tag ‘tiger’ and — if any files also have the tag “tiger” — will show those as a list.

In this way, you can construct URLs that allow you to browse tags in a way that makes sense to your visitors. For example, if you have a traditional article and have tagged it with tiger big stick poke roar chomp ouch hospital you could list all the tags under your article in your article form:

<txp:permlink><txp:title /></txp:permlink>
Filed in: <txp:category1 link="1" title="1" />
Tags: <txp:smd_tag_list><txp:smd_tag_name link="1" title="1" /></txp:smd_tag_list>

That makes a clickable link from each tag to your default tag section. So, in theory (you’ll see why in a sec) if you click on “roar” it will take you to the URL site.com/smd_tags/article/roar and on that Page you can do whatever you want: list other articles with the same tag, list other files that share the tag (like the example above), list other links that have the same category as the given tag. The sky’s the limit.

Well, it would be, except I think the URL scheme is broken :-( At least it’s broken in my dev copy. It might be because I killed it with something I did as I’m developing v0.2 or it could be that it’s also broken in v0.11.

In v0.11, the link="1" creates ‘messy’ URLs that use those other two attributes in the smd_tags prefs. It then makes links like:

site.com/smd_tags?smd_tagtype=article&smd_tag=roar

Behind the scenes the plugin is supposed to figure out what that means and present the correct list as if you’d done it with a clean URL. But I don’t know if it does. If not you can still make it work by manually constructing clean URLs in your anchors, but it’s a hassle you could do without. Taking the current permlink mode into account is slated for v0.2 (now I understand it all a bit more!)

YMMV: it might work as indicated above or may not. I know of a few other people using v0.11 and they’ve not complained so perhaps it is working; or perhaps they’re not using it in this way.

If it doesn’t work I will do my level best to get v0.2 out asap. I’m snowed under with a client site right now but should be clear in a few weeks. I know I’ve been promising this one for ages and I’m sorry it’s not quite all there but I’ll try and get this darn plugin singing like it should as soon as I can.

Does that give you any ideas or have I completely flummoxed you now? :-)

Last edited by Bloke (2009-01-15 00:24:55)


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB