Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Archives
  3. » [archived] jcb_columnize_body

#73 2005-10-02 12:36:09

mcbenton
Archived Plugin Author
From: Newark, NJ, US
Registered: 2005-05-13
Posts: 7
Website

Re: [archived] jcb_columnize_body

davidm,

I haven’t had time to work out the issue completely, but I believe the problem has something to do with the variable $remaining. $remaining is initialized by assigning it the value $totalLength which is set by calling the function strlen($body). The problem with doing this is that the value of $totalLength ends up being the total of ALL characters in the $body, regardless of whether or not they are displayed on the screen. In other words if the body were a string such as:

<code><p>Here is a link to <a href=“http://www.morphatic.com”>a great website</a>.</p></code>

Then $totalLength == 80, the total number of characters in the code, rather than 34 which is the total number of characters that should display on the screen. Logically if you are trying to divide up the text on your page into columns, the number you really want is this second value. In order to solve this problem, someone would need to create some sort of DOM type script that counts only characters in text nodes. It looks like a fun project, but I don’t have time to work on it just now.

FWIW, I abandoned the splitontag method of creating columns in favor of the splitonstring method. This method is not automatic, but it at least produces the desired result.

hope this helps,
Morgan

Offline

#74 2005-10-02 12:55:26

davidm
Member
From: Paris, France
Registered: 2004-04-27
Posts: 719

Re: [archived] jcb_columnize_body

Morgan, not meaning to criticize it’s a lot of work I realize that :) It’s not urgent per say but your plugin is so useful for complex layouts that it creates new needs :) Thanks for explaining how the plugin works, might prove useful to me :-D

Dropped the splitontag method entirely ? True, the splitonstring method is more precise but the problem with the splitonstring method is you usually split at the end of an html element (a div for example, or in my case the end of a table). If your content changes, you have to take into account and change the place of the split string. Not a problem when your writers are mindful and tech-wise, but not really dumb proof for some clients of mine :-o


.: Retired :.

Offline

#75 2005-10-02 13:56:43

mcbenton
Archived Plugin Author
From: Newark, NJ, US
Registered: 2005-05-13
Posts: 7
Website

Re: [archived] jcb_columnize_body

oh!

No criticism taken. :-)

It’s not actually my plugin, but was originally written by jimb. I only added a couple of changes in along the way. I agree that the splitontag method is more desirable and would like to fix it at some point if someone doesn’t beat me to it. Just thought I would share my observation of where I think the problem is in case someone else was in the mood to take it on. ;-)

Otherwise, I only dropped the splitontag because I had an immediate need and splitonstring fit the need. Maybe I can get back to it soon……

Offline

#76 2005-10-03 08:57:08

davidm
Member
From: Paris, France
Registered: 2004-04-27
Posts: 719

Re: [archived] jcb_columnize_body

Oops, sorry jimb for the mistake :-)
I kinda lost track there…

Yeah well, this plugin is not trivial and seems to be a real mathematical challenge… Anyone else has input about the use of the plugin ? We could try document whatever issues appear in different context…


.: Retired :.

Offline

#77 2005-10-03 14:54:14

jimb
Archived Plugin Author
From: Chicago, IL, USA
Registered: 2004-07-22
Posts: 27
Website

Re: [archived] jcb_columnize_body

Look for version .5 in a couple days. It will incorporate the tweaks that have worked for folks in this thread, as well as some other improvements. If there are any issues that haven’t been mentioned in this thread, now is the time so I can try to squash as much squirreliness as possible.

And thanks to everyone for posting back with input, it’s really hard to develop something like this when you don’t have time to test it in every possible scenario.

jimb

Last edited by jimb (2005-10-03 14:54:32)

Offline

#78 2005-10-03 15:22:41

davidm
Member
From: Paris, France
Registered: 2004-04-27
Posts: 719

Re: [archived] jcb_columnize_body

I’ll be looking close for .5 – testing and reporting on how it works…

Thanks again for this very powerful plugin !


.: Retired :.

Offline

#79 2005-10-04 06:10:53

jimb
Archived Plugin Author
From: Chicago, IL, USA
Registered: 2004-07-22
Posts: 27
Website

Re: [archived] jcb_columnize_body

So I’ve rewritten the entire plugin from scratch, and it’s almost done. It now splits the content up into nodes, and then looks at their average length and uses that to divide the content into columns. In-line tags (such as links) are now ignored when determining length. So far this seems to give more reliable results than the previous method.

0.5 is able to split based on tags or strings, similar to 0.4. I am also planning on implementing a ‘smart’ mode that will look for any block level element (p, ul, h) and split accordingly. It will also make sure that headings don’t end up at the very bottom of a column, etc. Smart mode is quirky right now and will probably wait until .6.

Here is the cool part: I stumbled upon an idea today that I think will massively improve the quality of columnizing for most uses. I’ve made a little test-suite of text that I run through the plugin for development of the plugin, and I have noticed that there is a (slightly fluid) consistant ratio of characters to lines in my columns. My plan is to clean up the test suite, and post it online for others to use. They will be able to use this test to tune the plug-in to the CSS they are using. The test will result in a number (mine’s been 31 so far) that can be passed in as an argument to allow for some much more intellegent column tuning.

Also: anyone that’s been having a difficult time getting this thing to work with their content, feel free to post/send me an example of what’s you’re passing to it. This would also help build the test suite.

Anyway, .5 is basically done, I just need to update to TXP 4.0 locally and make sure everything is working as it’s supposed to be.

Last edited by jimb (2005-10-04 06:12:08)

Offline

#80 2005-10-06 21:23:17

jimb
Archived Plugin Author
From: Chicago, IL, USA
Registered: 2004-07-22
Posts: 27
Website

Re: [archived] jcb_columnize_body

Presenting 0.5. Download

Changes:

Rewrite of almost all functionality. A few features have gone away but will be back if anyone misses them. I have updated the help accordingly. The big change is that the mode of columnizing is set by attribute mode, and can be equal to ‘tag’, ‘string’, or (soon) ‘smart’ or ‘words’.

In any mode, the attribute arg is used to pass needed info. So in ‘tag’ mode, arg should be set to the tags you want it to be aware of. You can pass multiple tags by separating them with a vertical pipe. In ‘string’ mode, arg should be set to the string to use as a break point.

Most everything else is the same, minsplit is gone for right now but will be back.

Also, please note when in ‘tag’ mode, the plugin will only columnize tags that you tell it about, so if you set *arg*=“p|dl|h3” and there are other tags in your content (say ul or h5 for example), they will be stripped out in the process of columnizing. Just an FYI. This issue will be solved by smart mode.

And as for the JavaScript version I promised a while back (like 6 months now), it will be coming eventually but I can’t say when. I’m pretty sure that I’ll be using TXP for a client site in the next few months, and my plan is to get it ready for that but I’ll have to see about time.

Kind of neat: there is now a debug mode built into the plugin. Turning this on will show how the plugin is turning the content into nodes, s well as column lengths in characters. To see this change this line:

define(‘JCBDBG’, false);

to:

define(‘JCBDBG’, true);

Anyhow, please beat this thing up and let me know what you think.

Last edited by jimb (2005-10-06 21:24:33)

Offline

#81 2005-10-09 20:37:30

davidm
Member
From: Paris, France
Registered: 2004-04-27
Posts: 719

Re: [archived] jcb_columnize_body

Thx jimb, I’ve downloaded 0.5 and will test it on a testsite I run…

I’ll report here for bugs or any feedback I get :-)


.: Retired :.

Offline

#82 2005-12-28 12:56:50

sekhu
Member
Registered: 2005-05-12
Posts: 428
Website

Re: [archived] jcb_columnize_body

any update on the progress and examples of this plugin? The plugins site is only updated to 0.3 I should add, going to give this a go when Smart Mode/Words is implemented since modifying 400 articles would be quite a long process.

Last edited by sekhu (2005-12-28 13:00:46)

Offline

#83 2006-02-07 09:02:47

Champak
Member
Registered: 2006-01-31
Posts: 56

Re: [archived] jcb_columnize_body

Is it possible to have the row lines inserted as well?

Offline

#84 2006-02-24 01:31:27

-rr-
Member
Registered: 2005-09-11
Posts: 73

Re: [archived] jcb_columnize_body

If I have an image that spans two columns, how can I make jcb_columnize to wrap the text around the image and not flow it over the image.

I tried adding {clear:both} to the columnized1 and 2 styles which didn’t work. I tried img{clear:both} too.

This could make really cool magazine type layouts. Any suggestions?

Offline

  1. Index
  2. » Archives
  3. » [archived] jcb_columnize_body

Board footer

Powered by FluxBB