1
MeNewbie
Word Wrapping in PHP, XOOPS and HTML
  • 2003/11/20 16:06

  • MeNewbie

  • Just popping in

  • Posts: 3

  • Since: 2003/11/20


Surely this is one of the most basic functions required for a webpage but I can't work it out for some reason. I just want to write a decent-sized article to display in the big gap in the centre of the page (centre block centre or centre block left is it?) that is word-wrapped. I'm sure it is a simple answer - please enlighten me!

I tried using C-Jay content but it only allows word-wrapped content under the C-Jay content menu.

I tried inserting this PHP code in the Block Editor part of XOOPs:

$text = "Hopefully this bloody well works! I have no idea why this mongrel thing doesn't work but I would put it down to having absolutely no idea about what the hell is going on... That may well have something to do with it. ";

print(wordwrap($text, 8, "\n", 1));

?>

and some variants of it, setting it as a PHP script, HTML document and Autoformat under the Content Type but to no avail...
Please help!

2
ackbarr
Re: Word Wrapping in PHP, XOOPS and HTML

newline characters are ignored in html when rendered. try changing your command to:

print(wordwrap($text8""1));

3
MeNewbie
Woohoo
  • 2003/11/20 22:59

  • MeNewbie

  • Just popping in

  • Posts: 3

  • Since: 2003/11/20


Awesome!

Thanks for the tip. The source of the problem was that I was putting the tags around the code when it seems that the XOOPS block editor was doing that anyway... What a newbie!

I used the following code to get the desired result which makes is wrap and adjust to the size of the window it is being displayed in:

print(wordwrap($text));

4
ackbarr
Re: Woohoo

you'll have to do that in the web-browser itself, probably by using the css width property. I would suggest limiting the width of your element to a percentage of the available screen real estate like so:
#myblock {width:90%;}

or make it relative to the font-size used:
#myblock {width:25em;}

5
MeNewbie
Got it.
  • 2003/11/21 1:52

  • MeNewbie

  • Just popping in

  • Posts: 3

  • Since: 2003/11/20


Thanks heaps for that!

Next question... How about modifying the properties of individual blocks, especially their appearances, within different themes?

Is this a task that I do by editing the sytle.css found within the relevant theme folder on my website? I want to change the background colour of the centre block to white.

Which part of the style.css determines the appearance of each of the blocks or is that under the html files found in the theme directories such as theme_blockcenter_c.html?

Login

Who's Online

366 user(s) are online (162 user(s) are browsing Support Forums)


Members: 0


Guests: 366


more...

Donat-O-Meter

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

Latest GitHub Commits