Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2007-09-20 19:34:23

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

Re: Lists with more than 3 li's are broke.

That’s a correct assumption.

Offline

#14 2007-09-27 08:45:48

fonant
New Member
From: West Sussex, UK
Registered: 2007-09-27
Posts: 4
Website

Re: Lists with more than 3 li's are broke.

If only I’d found this forum before finding my own fix for this! Thanks for the fix, folks, neater than mine.

Further down in the fList() function, should the line
$line .= n;
read
$line .= "\n";
It’s not obvious from the code why this was added…

Offline

#15 2007-09-27 20:40:22

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

Re: Lists with more than 3 li's are broke.

fonant,

No. It’s absolutely the same. It just output linebreak to the returned code. And by my self I would prefer that one without quotes.

Cheers!

Offline

#16 2007-09-27 21:27:38

fonant
New Member
From: West Sussex, UK
Registered: 2007-09-27
Posts: 4
Website

Re: Lists with more than 3 li's are broke.

Gocom wrote:

It’s absolutely the same.

Are you sure? On my server (PHP 5.2.4) n is treated as ‘n’ not as “\n”:

<?php
$fred = "fred";
$fred .= n;
echo nl2br($fred);
?>

outputs “fredn”, not “fred<br />”…

Perhaps this is another PHP version compatibility thing?

Offline

#17 2007-09-27 21:58:35

Manfre
Plugin Author
From: North Carolina
Registered: 2004-05-22
Posts: 588
Website

Re: Lists with more than 3 li's are broke.

Some lib files in txp have define("n","\n"); at the top. It’s not exposed everywhere in the code, which is why it’s not working for you.

Offline

#18 2007-09-28 09:02:18

fonant
New Member
From: West Sussex, UK
Registered: 2007-09-27
Posts: 4
Website

Re: Lists with more than 3 li's are broke.

Ah, I see. Isn’t it a bit odd, and against OO encapsulation, to make a class that’s broken without some external define()?

Is this just for the sake of a few characters in the code and some obscurity, or am I missing a more useful reason for doing this? There is only one instance of n in the class, and twelve instances of "\n"

I’m using classTextile.php with the Drupal textile module, which doesn’t define n. This means the textile module will be broken for Drupal users as they update to more recent versions of classTextile.php :(

I’ll patch my copy so the class stands on its own. Perhaps with:

<?php
# classTextile.php
if (!defined('n')) define('n',"\n");
?>

but more probably, to make the code readable, and consistent throughout the class definition, I’ll just replace that one n with "\n".

Thanks for the answers, and I really do like Textile :)

Offline

#19 2007-09-28 09:22:22

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

Re: Lists with more than 3 li's are broke.

^^ good point. If the rest of classtextile uses “\n”, then the “n” should probably be replaced.

Offline

#20 2007-10-02 12:12:56

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

Re: Lists with more than 3 li's are broke.

Anthony, the newline inconsistency is fixed in SVN 2669.

Offline

#21 2007-10-02 15:54:28

fonant
New Member
From: West Sussex, UK
Registered: 2007-09-27
Posts: 4
Website

Re: Lists with more than 3 li's are broke.

Thanks Ruud :) Drupal Textile users everywhere will be pleased!

Offline

Board footer

Powered by FluxBB