Recent Topics

1 Jul 07, 2016 03:27    

I'm trying to setup the custom definitions for autolinks. I've followed the docs on it and am having issues (nothing is happening). The built-in function for autolinking tags is working fine. I'm creating these definitions in the back office plugins settings, not in the file (will do that when it starts working).

Test case: Cowboys Nation

Trying to get that term to link to the Twitter profile of the same name isn't working. I have tried the following:

    []cowboys nation;;;https://twitter.com []cowboys;nation;;https://twitter.com
  • 'cowboys nation';;;https://twitter.com

None of which do anything at all to rendered posts or pages. I've tried those with and without the protocol (https://), though I see in the plugin code that it accepts URLs with and without just fine. Any ideas?

Thanks!

2 Jul 07, 2016 21:37

Try nation;cowboys;;https://twitter.com (yes, the order is reversed. The definition format evolved with the history of the plugin and is a little bit unfriendly)

3 Jul 07, 2016 22:59

That did work. Thank you.

In 90 percent of my own cases, I'm linking names and such (like the NFL's Cowboys QB "Troy Aikman" would link to his tag archive tag/Troy+Aikman/, for example). It seems the plugins functionality is limited to only two words, and in reverse order. As you said, unfriendly. I scanned the plugin file quickly and notice it's using regex for various functions, so wouldn't it be much more capable and friendly to users if it dropped the multiword syntax of word1;word2;;url and instead allowed for text string;;url?

The plugin's code is honestly a bit dense, so I wouldn't know where to start on making that particular adjustment. But it certainly seems to be the reasonable next step for development. Considering definitions are read line by line, easy enough to just ignore and preserve spaces from line start to the first semi-colon. For someone familiar with the code, that is.

Anyways, thanks again.

4 Jul 07, 2016 23:15

We'll make a complete overhaul of this plugin at some point, but you cannot imagine the size of our todo list.

The plugin used to be optimized for super fast processing of very long lists of keywords to replace. I am not sure if it still is the case.

5 Jul 08, 2016 01:40

Oh, I can imagine. It's a huge plus of b2evo that so much function is included in the core, but it also means there's infinitely more to do.

Currently, the plugin checks for the $word (first word in a definition), and then checks to see if it's preceded by the second word (I saw that in the code and still didn't think to reverse the order). Seems like additional logic is required doing it that way, as opposed to simply treating the entire string up to the first semi-colon as the word. No checking what comes when, just does it exist? If so, link it.

Probably an oversimplified view of it, but seems to work. But hell, I'm still impressed that it's done server-side and not with javascript after the DOM is loaded. My browser thanks you!


Form is loading...