Disco Octopus wrote :
Pierre Jelenc wrote : Disco Octopus <di**********@yahoo.com> writes: Pierre Jelenc wrote :
I need to wrap text with a negative indent, that is this:
*negative indent* is the crucial phrase.
and then i thought about it, and got this...
*Attempt 234* (and counting)
i think this will do the trick.
<?php
$v_indent = 3;
$v_wrapat = 40;
$v_nl = "\n";
$v_dent = "";
$v_i = 0;
while ($v_i < $v_indent) {
$v_dent = $v_dent . " ";
$v_i++;
}
$v_full_story = "This will wrap the first line of each paragraph at
character $v_wrapat or earlier. Each subsequent line will be wrapped
at character $v_wrapat less $v_indent. The \"less $v_indent\" takes
into account the extra characters placed before each of the lines for
the actual indent.
This will wrap the first line of each paragraph at character $v_wrapat
or earlier. Each subsequent line will be wrapped at character
$v_wrapat less $v_indent. The \"less $v_indent\" takes into account
the extra characters placed before each of the lines for the actual
indent.";
$v_paragraphs = explode ( $v_nl, $v_full_story);
echo "<pre>" . $v_nl;
reset($v_paragraphs);
while (list($key, $v_paragraph) = each($v_paragraphs)) {
$v_firstline = wordwrap ( $v_paragraph, $v_wrapat, $v_nl, 1);
$v_temp = explode ( $v_nl, $v_firstline);
$v_firstline = $v_temp[0];
$v_len = strlen ($v_firstline);
$v_restlines = substr ( $v_paragraph, $v_len + 1);
$v_restlines = wordwrap ( $v_restlines, $v_wrapat - $v_indent -
1, $v_nl, 1);
echo $v_firstline . $v_nl;
$v_restlines = str_replace ( $v_nl, $v_nl . $v_dent,
$v_restlines);
echo $v_dent . $v_restlines;
}
echo $v_nl . "</pre>" . $v_nl;
?>
--
if you pay for your gym memebership, use it