Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-04-19 18:53:32

M1rco
Member
Registered: 2008-04-19
Posts: 13

AJAX and Textpattern

Hi guys.
Just a little question. I want to use Textpattern as a blog system.
I tried all functions, all in all a very good system.
But I’ve got a problem. I want to use some AJAX featurs, e. g. expandable textareas.
But a “comment textarea” in Textpattern is a “special textpattern text”, no html.
How can I modify the “textpattern tag”?

And: can I write my blogentrys in pure html?

Offline

#2 2008-04-19 19:15:27

Ruhh
Member
From: dakota dunes
Registered: 2008-01-20
Posts: 305

Re: AJAX and Textpattern

You might have to hack the TXP file consisting the comment textarea.

And if you turn off textile in your blog entries, you can type in HTML.


<txp:Ruhh />

Offline

#3 2008-04-19 19:17:02

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: AJAX and Textpattern

But a “comment textarea” in Textpattern is a “special textpattern text”, no html

It does output regular (X)HTML ya know, so there shouldn’t be any problem at all. It works just like with any other website or layout, no change if we use TXP or not. Just link the script to textarea#message that is our comment form’s textarea.

In example with jquery (it’s textarea resizer):

jQuery.fn.resizehandle = function() {
	return this.each(function() {
		var me = jQuery(this);
		me.after(
			jQuery('<div class="resizer"></div>').bind(
				'mousedown', function(e) {
					var h = me.height();
					var y = e.clientY;
					var moveHandler = function(e) {
						me.height(Math.max(20, e.clientY + h - y));
					};
					var upHandler = function(e) {jQuery('body').unbind('mousemove',moveHandler).unbind('mouseup',upHandler);};
					jQuery('body').bind('mousemove', moveHandler).bind('mouseup', upHandler);
				}
			)
		);
	});
}
$(document).ready(function(){$("textarea#message").resizehandle();});

PS. that code is just a example of what I mean.

Last edited by Gocom (2008-04-19 19:20:09)

Offline

#4 2008-04-19 19:55:52

M1rco
Member
Registered: 2008-04-19
Posts: 13

Re: AJAX and Textpattern

Mh, sounds quite easy.
Will try this as soon as possible.
Thanks.

Edit: Err, Textpattern works with every AJAX-Framework? (e. g. mootools)

Last edited by M1rco (2008-04-19 20:03:13)

Offline

#5 2008-04-19 20:32:05

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: AJAX and Textpattern

As Gocom said: Textpattern outputs HTML like most any other CMS or web software out there.
It’s up to you to make the HTML work with any Javascript framework out there.

Regarding your question, yes, it will work with mootools, although Textpattern “official” JS library is jQuery


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#6 2008-04-19 21:07:46

M1rco
Member
Registered: 2008-04-19
Posts: 13

Re: AJAX and Textpattern

But, the Comment-Fields are dynamic, isn’t it?
Its not <input …>, it is <txp …>.

Does this work although?
(Do you know what I mean?

Offline

#7 2008-04-19 21:17:41

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: AJAX and Textpattern

When you apply JS, you apply it to the HTML rendered by the browser on the front-side of your site.
Textpattern tags aren’t HTML tags and aren’t sent to the browser. Textpattern tags are converted to HTML and that’s is what you see in the front-side of your website, and that is what JS is applied to.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB