Fork me on GitHub

Watch

GitHub Core

Show your support for Zikula! Sign up at Github account and watch the Core project!




GitHub Modules

Forum Activity

Forum feed

» Visit forum | » View latest posts

Store HTML in Database  Bottom

  • Simple Question.

    I have a textarea in my module and I wish store the content of this (it is HTML code). ┬┐How do you do this? When I store the content, may be formatted
    Ex:
    Content of textarea.

    Code

    How do you do?< br >Fine, Thanks!

    Content in phpMyAdmin.

    Code

    How do you do?& lt; br& gt ;Fine, Thanks!


    So, when I want to show
    How do you do?
    Fine, Thanks!

    Appear:

    Code

    How do you do?< br >Fine, Thanks!


    I try with

    Code

    <!--[$var1|pnvarprephtmldisplay]-->
    <!--[$var1|pnvarprepfordisplay]-->
    <!--[$var1]-->

    But it is not working with anything.

    Thanks!



    Edited by krator on Mar 23, 2012 - 03:29 PM.
  • If in your database is being stored with htmlentities, there's a problem.
    In phpMyAdmin it should look like normal characters, nothing like

    Code

    &lt; br& gt;


    To display them safely in the templates you use the HTML filter pnvarprephtmldisplay only, safehtml modifier in 1.3.2 :)

    See how you're processing your text before insert it to the database,
    it shouldn't modify the passed HTML tags.
    Or if you use a WYSIWYG editor, check what it gives to your PHP code.

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Hi Nestor.

    Well, I can see that in the tables of news module, the tags how < h 1 > or others are stored correctly.
    (In news module I use a WYSIWYG editor).
    In my module I use a simple textarea and I have tried use a simple assignment and the dbutil insertobject. I tried with pnvarprepareforstore, too.

    So, I unknow the reason for htmlentities.

    Thanks.
  • pnvarprepareforstore is the one, and doesn't affect HTML tags, only pnvarpreparefordisplay.

    The only possibility to have those entities is a bug using prepfordisplay instead prepforstore building the record. Ig you have entities in the DB records there's no chance to my imagination but an error like that :\

    --
    - Mateo T. -
    Mis principios... son mis fines

This list is based on users active over the last 60 minutes.