11
jackt
Re: HTML problem in XOOPS and Other CMS?
  • 2002/7/6 0:34

  • jackt

  • Just popping in

  • Posts: 31

  • Since: 2002/6/2 2


I ran into this same problem. I used NSections and needed to somehow bypass textsanitizer in some way from replacing my line breaks into
tags. What I did was include a new field in the database called "ignoreCR" (ignore carriage returns). This is either 0 or 1. The article view function detects this value. If it's 1 then you want to bypass the line break replace. What I do is include this line:

$content = preg_replace("/(\015\012)|(\015)|(\012)/","",$content);

to replace all line breaks. Now everytime you view your article it will replace all your line breaks so that none exist. Your content will be a glob of code with no line breaks. Therefore textsanitizer can't insert any line breaks when it runs. It also only does this on view, so your code in the database still looks line break formatted. You'll also need to add

,

,
, and
, depending on which you use for line breaking, to your allowable html. The ones with the '\>' closing are to keep the xhtml 1.0 standard. You may even want to add all these to your allowable html tags. I thought this might cause from problems with other content, but it hasn't and I don't see how a user can misuse these tags to screw up your site. The file to edit this is in class/xoopslists.php.

Now whenever I want to import content that is html preformatted I just paste it in, set ignoreCR to 1 and it'll skip all line break replacements. I also had to add this to the admin forms, but it didn't take much work. Works like a charm for me so far.


12
onokazu
Re: HTML problem in XOOPS and Other CMS?
  • 2002/7/6 1:50

  • onokazu

  • XOOPS Founder

  • Posts: 617

  • Since: 2001/12/13


If you need to just output data stored in DB as pure html, you can do so by just echoing the content.

so changing the line

echo makeTareaData4Show($content);

to

echo $content;

will allow you to just ouput your content in pure html format, bypassing the new line conversions in textsanitizer. However, this will also skip the smileys and xoopscodes conversions, and the allowed html tags checking routine.

13
bob
Re: HTML problem in XOOPS and Other CMS?
  • 2002/7/6 12:45

  • bob

  • Just popping in

  • Posts: 8

  • Since: 2002/1/9 1










In your code above, you might try adding valign="top" to the table and td tags in which you have a specific height value. See if that pulls the text up some.


14
danyblue
Re: HTML problem in XOOPS and Other CMS?
  • 2002/7/7 21:54

  • danyblue

  • Just popping in

  • Posts: 48

  • Since: 2002/4/15


Hi all,
the tag "valign" didn't worked.
In the between i Have tried to use layouts instead of tables, and althought the content was aligned in the top, it didn't respect the columns.
So i had an idea. wouldn't it be better to consider the "cell" between the columns of the portal, as a virtual screen, where are the contents could be indexed ( for instance in the case of using the DIV tags)...??
I will try the other suggestions to see if it solves the problem.

REgards,
Danyblue

15
danyblue
Re: HTML problem in XOOPS and Other CMS?
  • 2002/7/15 8:35

  • danyblue

  • Just popping in

  • Posts: 48

  • Since: 2002/4/15


Where can i find the function that is processing the the post? Because i Want to take a look at it and try to make some modifications.

Regards,
Danyblue

16
chapi
Re: HTML problem in XOOPS and Other CMS?
  • 2002/7/15 9:07

  • chapi

  • Theme Designer

  • Posts: 611

  • Since: 2002/1/22


I had html code like this in one of my sections.


   
     
   

       some content here
     


with this code it lowered down my content.
After changing the code to the following, i had no problems.

some content here


I just deleted the spaces between the tags themselves.

Maybe this helps somebody ...

17
danyblue
Re: HTML problem in XOOPS and Other CMS?
  • 2002/7/15 14:42

  • danyblue

  • Just popping in

  • Posts: 48

  • Since: 2002/4/15


Hi,
thank you for the suggestion, but it doesn't work.
The problem that i am having is just focused on the first lines. It is why i Would like to investigate a little bit the code.
I tried to search for textsanitizer, but the amount of references are so huge that i have problems finding it. Can any one point met to the correct function/module, where i could take a look?

Regards,
Danyblue

18
danyblue
Re: HTML problem in XOOPS and Other CMS?
  • 2002/7/16 9:27

  • danyblue

  • Just popping in

  • Posts: 48

  • Since: 2002/4/15


Hi,
I have found the function textsanitizer, which for me a non programmer was quite difficult.
I have been trying, from the explainations above, where could the problem be, in order to see if I could do something.
I have found the function where the problem might be,
function oopsNl2Br($text) {

$text =preg_replace("/(\015\012)|(\015)|(\012)/","
", $text);

And i have tried several things that i have search on the net.
the first one was

$text = str_replace("
", "","$text");
Which i think is replacing every
by a space character, which would be the same thing than having nothing.
SO i commented the function also to see what happen, and it's work.
SO i would like to know what would be the implication of leting it that way, since it is working for me, will I be seing problems in other places?

Regards,
Danyblue

19
jackt
Re: HTML problem in XOOPS and Other CMS?
  • 2002/7/16 10:48

  • jackt

  • Just popping in

  • Posts: 31

  • Since: 2002/6/2 2


Well.. this line..

$text =preg_replace("/(\015\012)|(\015)|(\012)/","
", $text);

on display, text sanitizer will not replace all line breaks with
tags. So if you say post a news article it wont output any line breaks submit.

The line you added removes all
tags. So there will never be any line breaks in anything you post. At least none will be output. Basically text sanitizer converts line breaks into
and then your line deletes that
and all others. By default
isn't in the "allowed html" anyways, but I added it to my XOOPS config.

I'm not sure what you are trying to do. I'll assume you're posting html into the textarea and it's coming out with a lot of
tags ruining your formatting. Well what you did will prevent ANY line breaks from being displayed that goes thru text sanitizer, which accounts for just about (if not) all XOOPS modules that come packaged with xoops.

I've hacked up Haruki's wfsection module to include a switch to Enable Line Break Filtering on display. So when you check it, the script will filter out any line breaks in your code before it runs thru text sanitizer. This may solve your line break problem, but text sanitizer will still check for "allowed html". So if you're using any weird tags it still might cause you problems.. I'll add a checkbox to disable html, smilies and forum codes a little later. You can try this hacked up wfsections module here:

http://www.dailabs.com/wfsection_hack-612.zip

I'd suggest you try it out before using it in production environment.. I'll take no responsibility if anything blows up tho it shouldn't.

20
danyblue
Re: HTML problem in XOOPS and Other CMS?
  • 2002/7/16 12:47

  • danyblue

  • Just popping in

  • Posts: 48

  • Since: 2002/4/15


Hi jackt,

you are module is working fine, i have been able to post my content the way i wanted.
Does your module support [pagebreak]?

Regards,
Danyblue

Login

Who's Online

270 user(s) are online (170 user(s) are browsing Support Forums)


Members: 0


Guests: 270


more...

Donat-O-Meter

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

Latest GitHub Commits