Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#801 2017-07-23 09:39:45

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 272
Website

Re: tru_tags: A tagging plugin for textpattern

With textpattern 4.6.2 and tru_tags 3.9 the for me very important auto complete function stopped working. Stylesheet and script are now placed right before the <!DOCTYPE html>

The javascript file doesn’t seems to be still necessary, because the autocomplete function is now part of jquery-ui which is also loaded by the admin-side theme.

How to get the code back into the html body or the head? There is this “head_end” callback, but I don’t know how to change the code for using it right, due to my limited programming skills.

Offline

#802 2017-07-23 21:30:43

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 272
Website

Re: tru_tags: A tagging plugin for textpattern

A quick and dirty solution, which is working for me and with the help of this auto complete example from here:

function tru_tags_admin_write_tab_handler($event, $step, $data) {
	global $tru_tags_prefs;
	$atts = tru_tags_get_standard_cloud_atts(array(), true, true, true);
	$cloud = array_unique(tru_tags_cloud_query($atts));
	natcasesort($cloud);

	$id = (empty($GLOBALS['ID']) ? gps('ID') : $GLOBALS['ID']);
	$article_tags = (empty($id) ? array() : tru_tags_get_tags_for_article($id));

	$links = array();
        global $raw_cloud;
	$raw_cloud = '';
	foreach ($cloud as $tag) {
		$style = (in_array($tag, $article_tags) ? ' class="tag_chosen"' : '');
		$links[] = '<a href="#advanced"'.$style.' onclick="toggleClass(this, toggleTag(\\\''.addslashes(addslashes(htmlspecialchars($tag))).'\\\')); return false;">' . addslashes(htmlspecialchars($tag)) . '<\/a>';
		$raw_cloud .= '"' . addSlashes($tag) . '",';
	}
	$raw_cloud = substr($raw_cloud, 0, strlen($raw_cloud) - 1);
	$to_insert = join(', ', $links);

	if ($tru_tags_prefs[TAGS_IN_WRITE_TAB]->value) {
		$js = <<<EOF
			var keywordsField = document.getElementById('keywords');
			keywordsField.parentNode.appendChild(document.createElement('br'));
			var cloud = document.createElement('span');
			keywordsField.parentNode.appendChild(cloud);
			cloud.setAttribute('class', 'tru_tags_admin_tags');
			cloud.innerHTML = '{$to_insert}';

			var styleElement = document.createElement('style');
			styleElement.setAttribute("type", "text/css");
			var styleText = 'a.tag_chosen{background-color: #FEB; color: black;}';
			if (styleElement.styleSheet) { //IE
				styleElement.styleSheet.cssText = styleText;
			} else {
				var textNode = document.createTextNode(styleText);
				styleElement.appendChild(textNode);
			}
			var headElement = document.getElementsByTagName('head')[0];
			headElement.appendChild(styleElement);

			function toggleTag(tagName) {
				var regexTag = tagName.replace(/([\\\\\^\\$*+[\\]?{}.=!:(|)])/g,"\\\\$1");
				var tagRegex = new RegExp("((^|,)\\\s*)" + regexTag + "\\\s*(,\\\s*|$)");
				var textarea = document.getElementById('keywords');
				var curval = textarea.value.replace(/,?\s+$/, '');
				if ('' == curval) {
					textarea.value = tagName;
				} else if (curval.match(tagRegex)) {
					textarea.value = curval.replace(tagRegex, '$1').replace(/,?\s+$/, '');
					return '';
				} else if (',' == curval.charAt(curval.length - 1)) {
					textarea.value += ' ' + tagName;
				} else {
					textarea.value += ', ' + tagName;
				}
				return 'tag_chosen';
			}

			function toggleClass(element, className) {
				element.setAttribute('class', className);
				element.setAttribute('className', className); /* for IE */
			}
EOF;
		return $data . script_js($js);
	}

	if ($tru_tags_prefs[AUTOCOMPLETE_IN_WRITE_TAB]->value) {

		register_callback('tru_tags_admin_write_tab_bodyend', 'admin_side', 'body_end');

                function tru_tags_admin_write_tab_bodyend ($event, $step) {
                          global $raw_cloud;

                          $output='<link rel="stylesheet" type="text/css" href="../js/jquery.autocomplete.css" media="projection, screen" />
         			<script language="JavaScript" type="text/javascript"><!--
          				$(document).ready(function(){ 
          				    var availableTags = ['.$raw_cloud.'];
          				    function split( val ) { return val.split( /,\s*/ ); }
          				    function extractLast( term ) { return split( term ).pop(); }
          				    $("#keywords").autocomplete({ minLength: 0, 
          				                                  source: function( request, response ) {
          				                                            // delegate back to autocomplete, but extract the last term
          				                                            response( $.ui.autocomplete.filter(
          				                                              availableTags, extractLast( request.term ) ) );
          				                                          },
          				                                          focus: function() {
          				                                            // prevent value inserted on focus
          				                                            return false;
          				                                          },
          				                                          select: function( event, ui ) {
          				                                            var terms = split( this.value );
          				                                            // remove the current input
          				                                            terms.pop();
          				                                            // add the selected item
          				                                            terms.push( ui.item.value );
          				                                            // add placeholder to get the comma-and-space at the end
          				                                            terms.push( "" );
          				                                            this.value = terms.join( ", " );
          				                                            return false;
          				                                  }});
         				});
            			//--></script>';
                           echo n.$output.n;
                	}

        }

}

Last edited by whocarez (2017-07-23 21:44:29)

Offline

#803 2018-05-01 19:51:51

moon blake
Member
From: near Hannover, Germany
Registered: 2009-07-16
Posts: 74

Re: tru_tags: A tagging plugin for textpattern

michaelkpate wrote #305227:

As someone who has been using tru_tags on their personal site for nearly a decade, good to have you back.

I am trying to get tru_tags 3.9 working on a site running 4.7 dev. I am constantly getting this error in the backend.

A problem occurred while loading the plugin: tru_tags -> User_Error: Table '[databasename].tru_tags_prefs' doesn't exist on line 409...

While michaelkpate reports an issue with true_tags under 4.7 I get the said error under 4.6.2
Any idea how to solve this?
Looking it up in phpMyAdmin I am also wondering if it is correct that there seems to be no table added to the database by the true_tags plugin.
Thanks for any hint.

Offline

#804 2018-05-01 20:11:48

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,232

Re: tru_tags: A tagging plugin for textpattern

Have you seen makks’ reply?

makss wrote #306363:

Perhaps fixed , please check.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#805 2018-12-02 14:44:16

BryanA.
Member
From: Maryland, USA
Registered: 2007-08-12
Posts: 96

Re: tru_tags: A tagging plugin for textpattern

Is it possible to create different clouds or sets of tags for different categories?


The WIPsnakebite.cafe
A place for conversations like #techxiety the podcast. Textpattern is my Valentine’s date.

Offline

#806 2020-03-04 10:44:49

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 230
Website

Re: tru_tags: A tagging plugin for textpattern

Every tag leads to the 404 error page after upgrading to Textpattern v4.8.0 :-(

Tag links and the tag cloud remain correct. The latest tru_tags version 3.7.

Offline

#807 2020-03-04 11:10:05

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

Re: tru_tags: A tagging plugin for textpattern

Vienuolis wrote #322052:

Every tag leads to the 404 error page after upgrading to Textpattern v4.8.0 :-(

Tag links and the tag cloud remain correct. The latest tru_tags version 3.7.

I do not know a fix for it, but this might be because the plugin is not taking into account the new url schemas.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#808 2020-03-04 11:13:15

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

Re: tru_tags: A tagging plugin for textpattern

Nope, seems to be a bug in 4.8.0. I don’t think there’s anything that can be done in the plugin to fix this, because Txp is throwing out the URL before the plugin even has a chance to intervene. Same with smd_tags. We’ll have to figure this out in core. Sorry for the hassle.


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

#809 2020-03-04 12:02:37

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 230
Website

Re: tru_tags: A tagging plugin for textpattern

Strange behavior: somewhat hidden messy tag URL in a clean URL scheme:

https://on.lt/dalykai/tiesa/

where: ‛tiesa’ is a tag (keyword), and ‛dalykai’ — Lithuanian substitution of the English word ‛tags’.

The bold URL here is obtained by PHP as an environment variable:

 	<txp:php> 
$urn = urldecode($_SERVER['REQUEST_URI']);
$urh = "{$_SERVER['HTTP_SCHEME']}://{$_SERVER['HTTP_HOST']}";
echo $urh . $urn;
	</txp:php>

Where the ?t= comes from?

Offline

#810 2020-03-11 18:56:34

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 230
Website

Re: tru_tags: A tagging plugin for textpattern

<meta::description format="" /> output disappear on sections after Textpattern 4.7.3 → 4.8.0 upgrade. No warnings while in debugging mode. And no changes on Meta description docs since v4.6.0.

type="article" context attribute solved the problem. Could this be the cause for tru::tags error 404, too?

Offline

Board footer

Powered by FluxBB