Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-12-17 04:06:06

jackysee
New Member
Registered: 2004-09-28
Posts: 5

[textile] Link to a reference cannot use 0

Some problem with the link refernece.

I tried to do this

"yahoo":0
[0]http://www.yahoo.com

It gives me

<a href="">yahoo</a>

Is it related to PHP version?

Offline

#2 2007-12-17 05:43:43

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: [textile] Link to a reference cannot use 0

No, but you can’t link to a zero. What do you expect <a href="0">yahoo</a> to do? If you’re talking about linking within a page (anchors), then you’d use:

"yahoo":#0

Keep in mind that numbers are invalid id values, so h2(#0). yahoo's destination wouldn’t work. You’d need:

"yahoo":#b0
h2(#b0). yahoo's destination

Last edited by jm (2007-12-17 05:48:12)

Offline

#3 2007-12-17 06:30:24

jackysee
New Member
Registered: 2004-09-28
Posts: 5

Re: [textile] Link to a reference cannot use 0

I think you mis-read my code.
[0] is refer to a link reference below.

"yahoo":0
[0]http://www.yahoo.com

But it WORKS for:

"yahoo":1
[1]http://www.yahoo.com

In the past, it always work for number.
But it seems that after upgrade to PHP 5, it just won’t work for 0.

Of course I can try to avoid that when posting, but the problem is many of my old articles are using [0] as link reference.

Last edited by jackysee (2007-12-17 06:31:27)

Offline

#4 2007-12-17 08:06:40

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: [textile] Link to a reference cannot use 0

Doesn’t work with PHP4.3 either, so it’s not PHP related.

Offline

#5 2007-12-17 18:28:27

jackysee
New Member
Registered: 2004-09-28
Posts: 5

Re: [textile] Link to a reference cannot use 0

I take a look at the code, it seems that line 801 of classTextile.php is causing this problem.

	function shelveURL($text)
	{
		if (!$text) return '';
		$ref = md5($text);
		$this->urlshelf[$ref] = $text;
		return 'urlref:'.$ref;
	}

The first if will return true even for string ‘0’. i.e. (!'0') is true.
If that checking is just to prevent empty string, it can use $test==''

Last edited by jackysee (2007-12-17 18:30:30)

Offline

#6 2007-12-17 18:48:23

jackysee
New Member
Registered: 2004-09-28
Posts: 5

Re: [textile] Link to a reference cannot use 0

Don’t know if it’s appropriate, I reported the bug at the textile page.

Offline

#7 2007-12-17 18:50:28

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: [textile] Link to a reference cannot use 0

is zem even supporting textile anymore?

Last edited by iblastoff (2007-12-17 18:50:39)

Offline

#8 2007-12-17 19:12:37

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: [textile] Link to a reference cannot use 0

Yes, as far as I know, although if there’s a bug that’s easy to fix, I can commit changes as well (as can any of the other TXP devs).

Offline

Board footer

Powered by FluxBB