Problem with CMS

0

I have on a website a small CMS (based on SCC Editor) that allows you to create ordered and unordered lists, bold, italics and something else. As writing in the database the text of that textarea where the CMS works included the tags in [] [/] format, I applied a strreplace like this:

//Crear parrafos y reemplazar corchetes
$articulo = $_POST['articulo'];
$articulo = str_replace("[","<",$articulo);//cambiar abrir corchete por <
$articulo = str_replace("]",">",$articulo); //cambiar cerrar corchete por >
  $InsertQuery->bindColumn("articulo", "s", "".((isset($articulo))?$articulo:"")  ."", "WA_DEFAULT");
  $InsertGoTo = "comprobar_post.php";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
 }

And it works, since in the bbdd he writes

 <b>texto</b> 

for a bold text.

The problem comes when I retrieve that text to include it in the publication that shows me

 <b>texto</b> 

instead of text as it should.

Here I put the select script:

<?php
$rsModificarPost = new WA_MySQLi_RS("rsModificarPost",$Prueba_MCC_i,1);
$rsModificarPost->setQuery("SELECT * FROM post ORDER BY post.p_id DESC");
$rsModificarPost->execute();
?>

And here I recover the text already in the body of the php document where it is published with its nl2br to generate appearances of line height:

<div style="color:#000000; font-weight:400; border-bottom:1px #CCC dotted; padding-bottom:20px;">
 <?php echo  nl2br($rsModificarPost->getColumnVal("articulo")); ?>

</div>

Can someone help me, please? Thank you very much

    
asked by Ml Saura 12.10.2018 в 12:07
source

1 answer

1

Thank you very much, zerocool. In the end I solved it by simplifying things and reversing the order: in my initial idea was replacing the brackets that my data entry provides me (for an element ' text ' SCC Editor writes to me '[b ] text [/ b] ') so that the html was already written in the database.

So I deleted that filter in the data entry and put it in the output when I do the echo that prints the contents of the article column.

I have created a variable '$ article'. This is my script:

div class="articulo">
        <?php 
        $articulo = nl2br($rsListado->getColumnVal("articulo"));
        $articulo = str_replace("[","<",$articulo);//cambiar abrir corchete por <
        $articulo = str_replace("]",">",$articulo); //cambiar cerrar corchete por >
        $articulo = str_replace("&#x2F;","/",$articulo); //cambiar htmlentitie cerrar por/ >
 echo ($articulo); 
        ?> 

</div>

Thank you for your attention and greetings. :)

    
answered by 16.10.2018 / 09:21
source