Ask a Question related to PHP Development, Design and Development.
-
Tim #1
Split text into two columns
Hi
I want to be able to split the contents of a text field into two or maybe
three columns. The text field contains text AND HTML mark-up.
My initial thought was to find the middle character and then go to the
nearest space and split the text that way, but it sometimes splits in the
middle of an HTML tag: not pretty!
My next idea was to strip the HTML tags from the text and then split it up
and then reapply the HTML tags, but I am not sure this would work either.
Has anyone come across this problem and do you have a solution or know of
one? I would really appreciate it.
Thanks
Tim
Tim Guest
-
how to split continuous text in a variable into two text-variables...?
Hi, i have a little problem. i need to split a continuous text-variable into two text-variables but in whole words! so i can show these two... -
Dynamic text fields. Continuing text over columns
Hi I'm doing a mock up news paper article over 4 columns in flash mx and the text loads in dynamically. I have 4 dynamic text boxes sitting side... -
Split Text Block into Paragraphs
I have this large text block, but I would like to split it into smaller ones by a number of characters. It needs to _split at whole words_, and not... -
seperating columns in a text box into multiple text boxes?
Berney: You probably are better off doing this separating in the query data source for your form. You can use string commands to find which... -
Can we split content region into two columns?
Folks, Does there exist a way to create CSS that makes a single block of text display in two columns? Warm regards, Steve Perth, Western... -
Nikolai Chuvakhin #2
Re: Split text into two columns
"Tim" <tjccowan@hotmail.com> wrote
in message news:<lwlSa.9636$104.1068452@news20.bellglobal.com >...First of all, understand that you will NOT be able to do this>
> I want to be able to split the contents of a text field into
> two or maybe three columns. The text field contains text AND
> HTML mark-up.
as precisely as you would on a printed page. In particular,
there is no way to enforce smooth transition from one column
to another in the middle of a sentence.
How about finding the <p>, <h?>, or <?l> tag most closely following> My initial thought was to find the middle character and then
> go to the nearest space and split the text that way, but it
> sometimes splits in the middle of an HTML tag: not pretty!
the middle character?
Cheers,
NC
Nikolai Chuvakhin Guest
-
P'tit Marcel #3
Re: Split text into two columns
Tim écrivit:
function split_pos($text) {> I want to be able to split the contents of a text field into two or
> maybe three columns. The text field contains text AND HTML mark-up.
>
> My initial thought was to find the middle character and then go to the
> nearest space and split the text that way, but it sometimes splits in
> the middle of an HTML tag: not pretty!
/* find middle space in text */
$mid = (int) strlen($text)/2 - 1;
$cut = strpos($text , ' ' , $mid);
$part1= substr($text , 0 , $cut + 1);
$pos1 = strrpos($part1 , '<');
$pos2 = strrpos($part1 , '>');
if (($pos1 < $pos2) or ($pos1 === False))
return $cut; */ no html tag around */
$pos3 = strpos($text , '>' , $cut1 + 1);
if($pos3 !== False)
return $pos3; */ end of middle html tag */
else return $cut; */ unbalancing < > */
}
not tested
hth
--
P'tit Marcel
P'tit Marcel Guest



Reply With Quote

