Advertisement:

Author Topic: Issue with osc_item_description() it automatically adding <br> in every line  (Read 2585 times)

xweaver

  • Newbie
  • *
  • Posts: 11
Issue:
It automatically adding extra <br> in every line in the Front end Ad View page when i used the Rich Edit plugin. When you add/edit in the front end or admin the content you are editing is ok same when you check the data in the database there is no extra <br> added.  Upon checking,  i noticed that when English Language is used you will see the extra array of the content for that language. you can see it when you use osc_item() function. It also affected the html list like <ul> and <ol> because its adding extra br for every <li>

Below is the contents from osc_item(). I just posted here the important elements in which you have 2 s_description(1 for the language and 1 for the original content)
...........
 ["locale"]=>
  array(1) {
    ["en_US"]=>
    array(4) {
      ["fk_i_item_id"]=>
      string(1) "1"
      ["fk_c_locale_code"]=>
      string(5) "en_US"
      ["s_title"]=>
      string(10) "Example Ad"
      ["s_description"]=>
      string(223) "<p>Description of the example ad. Insert here some usefull description of your ad.</p><br />
<ul><br />
<li>dwqdqwdqwqwd</li><br />
<li>dwqdwq</li><br />
<li>dw</li><br />
<li>qdqw</li><br />
<li>dqw</li><br />
</ul>"
    }
  }
  ["s_title"]=>
  string(10) "Example Ad"
  ["s_description"]=>
  string(181) "<p>Description of the example ad. Insert here some usefull description of your ad.</p>
<ul>
<li>dwqdqwdqwqwd</li>
<li>dwqdwq</li>
<li>dw</li>
<li>qdqw</li>
<li>dqw</li>
</ul>"
..........

Using this osc_item_description() function will give you the description with added extra <br> in every line so what i did was to use the array instead using my codes below:
<?php
 $handle_desc = osc_item();
echo $handle_desc["s_description"];

?>

I hope someone has to fix the osc_item_description() that whatever you have in the content should be the same output without the extra <br> added. I assumed that the<br> is for non html contents

Thanks and God bless





 




frosticek

  • Hero Member
  • *****
  • Posts: 3948
@xweaver
This is generated by osclass or richedit plugin. But I do not see anything wrong on <br/>. Yes they are old, but works good.

xweaver

  • Newbie
  • *
  • Posts: 11
@frosticek yes it does, using Richedit is not a problem its only when you see it in the page. its not good that every line you have to add <br> just like when you insert <ol> or <ul> in the rich editor. osclass automatically add extra <br> see my sample html below from richedit
<ol>
<li>Sample</li>
</ol>

when you publish and check the value in the database and when you edit the html is working good no "<br>"

now once published and see it in the detailed page of the ad page the output now will become
<ol><br>
<li>Sample</li><br>
</ol><br>


So by looking the results above its not good....







SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Ahum didn't see this post.... now I also understand your remark in the other post design!  ;D

darmeth

  • Jr. Member
  • **
  • Posts: 75
Issue seems to be Rich Edit plugin related. Because we are still using the version from the Stone Age.  >:(

I had very messy HTML output and by changing one line in tiny_mce.js this fixed everything.

Go to tiny_mce_scr.js and search for

Code: [Select]
addValidElements('span
I cannot remember the rest of the line but it looks something like this: addValidElements('span[!mce...blah blah blah]');

Replace only that line with this:

Code: [Select]
addValidElements('span[!class]');
This change alone solved my <br> and my <span style="line-height:1.5em"> issues. Now, I get nice clean HTML with no rubbish in there.

Make the change then minify tiny_mce_scr.js and once compressed, replace  tiny_mce.js and upload to your site.
Of course, always back up your files first.

One more point - don't judge Rich Text at the input stage. The text needs to go through the clean up process, so your output will be different. Also, Chrome and IE give different results when compared with Firefox and Safari, so test all the way with your new advert listing.

If you cannot get the bullets and numbers lists to work, come back and let me know. You may need to specify it in your theme css file.
« Last Edit: December 13, 2014, 10:59:44 pm by darmeth »

frosticek

  • Hero Member
  • *****
  • Posts: 3948
@jimzubemo
However any osclass update will remove this changes as those are done in osclass core files.

jimzubemo

  • Newbie
  • *
  • Posts: 29
@jimzubemo
However any osclass update will remove this changes as those are done in osclass core files.
So then how do we resolve this without touching core?