xoops forums

jackt

Just popping in
Posted on: 2002/7/6 0:34
jackt
jackt (Show more)
Just popping in
Posts: 31
Since: 2002/6/2 2
#11

Re: HTML problem in XOOPS and Other CMS?

I ran into this same problem. I used NSections and needed to somehow bypass textsanitizer in some way from replacing my line breaks into <br \> 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 <p \>, <p>, <br>, and <br \>, 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.

onokazu

XOOPS Founder
Posted on: 2002/7/6 1:50
onokazu
onokazu (Show more)
XOOPS Founder
Posts: 617
Since: 2001/12/13
#12

Re: HTML problem in XOOPS and Other CMS?

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.

bob

Just popping in
Posted on: 2002/7/6 12:45
bob
bob (Show more)
Just popping in
Posts: 8
Since: 2002/1/9 1
#13

Re: HTML problem in XOOPS and Other CMS?

<table border="0" width="913" bgcolor="#FFFFFF" cellspacing="1" height="2194" >
<tr>
<td width="148" height="132">
<p align="left"> </p>
</td>
<td width="751" colspan="4" rowspan="3" height="443">
<p align="left">

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.

danyblue

Just popping in
Posted on: 2002/7/7 21:54
danyblue
danyblue (Show more)
Just popping in
Posts: 48
Since: 2002/4/15
#14

Re: HTML problem in XOOPS and Other CMS?

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

danyblue

Just popping in
Posted on: 2002/7/15 8:35
danyblue
danyblue (Show more)
Just popping in
Posts: 48
Since: 2002/4/15
#15

Re: HTML problem in XOOPS and Other CMS?

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

chapi

Theme Designer
Posted on: 2002/7/15 9:07
chapi
chapi (Show more)
Theme Designer
Posts: 611
Since: 2002/1/22
#16

Re: HTML problem in XOOPS and Other CMS?

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

<table>
&nbsp;&nbsp;&nbsp;<tr>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<td>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;some content here
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
&nbsp;&nbsp;&nbsp;</tr>
</table>

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

<table><tr><td>some content here</td></tr></table>

I just deleted the spaces between the tags themselves.

Maybe this helps somebody ...

danyblue

Just popping in
Posted on: 2002/7/15 14:42
danyblue
danyblue (Show more)
Just popping in
Posts: 48
Since: 2002/4/15
#17

Re: HTML problem in XOOPS and Other CMS?

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

danyblue

Just popping in
Posted on: 2002/7/16 9:27
danyblue
danyblue (Show more)
Just popping in
Posts: 48
Since: 2002/4/15
#18

Re: HTML problem in XOOPS and Other CMS?

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)/","<br />", $text);

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

$text = str_replace("<br />", "","$text");
Which i think is replacing every <br /> 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

jackt

Just popping in
Posted on: 2002/7/16 10:48
jackt
jackt (Show more)
Just popping in
Posts: 31
Since: 2002/6/2 2
#19

Re: HTML problem in XOOPS and Other CMS?

Well.. this line..

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

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

The line you added removes all <br /> 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 <br /> and then your line deletes that <br /> and all others. By default <br /> 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 <br /> 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.

danyblue

Just popping in
Posted on: 2002/7/16 12:47
danyblue
danyblue (Show more)
Just popping in
Posts: 48
Since: 2002/4/15
#20

Re: HTML problem in XOOPS and Other CMS?

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