1
ABurgoyne
Problem with line-wrapping.....
  • 2006/12/27 0:05

  • ABurgoyne

  • Just popping in

  • Posts: 6

  • Since: 2006/12/26


Hi!

I am trying to help my wife build a XOOPS 2.0.16 site but have run across a small formatting issue.

Basically, long lines of text do not wrap/break properly which cause blocks to activate horizontal scrollbars and/or force the width of the page to increase, both of which detract from the look of the site.

The problem seems to exist throughout XOOPS and the various modules (articles & blogs in particular) we have installed.

I have hunted for a solution but as I'm very new to the inner workings of the script, it has been a long, painful and, so far, fruitless search

Has anyone got a fix for this?

Regards, Adam

2
JMorris
Re: Problem with line-wrapping.....
  • 2006/12/27 0:24

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


Can you provide an example of the line-wrapping?

If you are referring to URLs, simply wrap a descriptive word or phrase in the [url ] tags.

If you are referring to code or quotes, use the CSS overflow attribute to create a scrolling box

div.xoopsCode {
    
background#2A220E;
    
border1px solid #A27900;
    
color#EEE;
    
width400px;
    
max-height250px;
    
margin0.125em;
    
overflowauto;
    
padding5px;
    
fontFixedSys"Courier New"Couriermonospace;
    
text-align:left;
}
div.xoopsQuote {
    
background#2A220E;
    
border1px solid #A27900;
    
color#EEE;
    
width400px;
    
max-height250px;
    
margin0.125em;
    
overflowauto;
    
padding5px;
    
fontFixedSys"Courier New"Couriermonospace;
    
text-align:left;
}


HTH.

James
Insanity can be defined as "doing the same thing over and over and expecting different results."

Stupidity is not a crime. Therefore, you are free to go.

3
ABurgoyne
Re: Problem with line-wrapping.....
  • 2007/1/23 13:26

  • ABurgoyne

  • Just popping in

  • Posts: 6

  • Since: 2006/12/26


Thanks for the feedback but it doesn't really apply to my problem. Basically, if I type a very long, unbroken line of characters into, for instance, an article post or forum comments (pretty much any editable textarea field) i.e.

ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss


then the line will not wrap at a sensible width and, instead, displaces the right side of my site layout - just like this example has. I've really come to the end of the line with it and just hope you can come up with a solution.

EDIT: Yes, we get the point. Line edited for readability.

4
JMorris
Re: Problem with line-wrapping.....
  • 2007/1/23 13:42

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


You could try the PHP wordwrap function.http://us3.php.net/wordwrap
Insanity can be defined as "doing the same thing over and over and expecting different results."

Stupidity is not a crime. Therefore, you are free to go.

5
Peekay
Re: Problem with line-wrapping.....
  • 2007/1/23 15:42

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


AFAIK, as JMorris suggests you can either force scrollbars using CSS for the class:

div.xoopsCode {
overflow: auto ;
}

or hack the PHP function(s) that output the text. I have seen PHP wordwrap suggested before:

$wrappedText wordwrap($text80"<br>n"1);


and another post in this thread suggests using regex:

Quote:

TheCleric wrote:

under the frameworks>textsanitizer there is a module.textsanitizer file.

You could add something like

$patterns[] = "/(\w{50})/sU";
$replacements[] = '\\1 ';



under the lines

function &xoopsCodeDecode(&$text, $allowimage = 1)
{
$patterns = array();
$replacements = array();


That will insert a space in the display whenever there are 50 characters in a row. Essentially, the longest word possible will be 50 characters.

It won't break up words with punctuation, so it shouldn't break long URLs.


I guess one of these should work!
A thread is for life. Not just for Christmas.

6
ABurgoyne
Re: Problem with line-wrapping.....
  • 2007/1/30 21:17

  • ABurgoyne

  • Just popping in

  • Posts: 6

  • Since: 2006/12/26


Thanks to JMorris and PeeKay - I have tried the wordwrap approach in a couple of places and it certainly did the job but I'll try the regex alternative too.

7
TheCleric
Re: Problem with line-wrapping.....
  • 2007/1/30 23:26

  • TheCleric

  • Just popping in

  • Posts: 22

  • Since: 2006/12/26


The regex is only preferable to the wordwrap function in that you can specify more directly what types of strings NOT to wrap, and the behavior can be more closely changed. You could potentially change the font size, wrap a spoiler block around it, erase the long line and leave a pleasant message behind, etc.

Wordwrap is ideal if all you want is a strict limit on the length of a line.

8
Peekay
Re: Problem with line-wrapping.....
  • 2007/1/30 23:50

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Some nice solutions to a common worry. The Cleric's regex is a new one to me. Bookmarked!
A thread is for life. Not just for Christmas.

Login

Who's Online

155 user(s) are online (92 user(s) are browsing Support Forums)


Members: 0


Guests: 155


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits