Fork me on GitHub

Getting data out of database the way I entered it  Bottom

  • I'm writing a new module that allows the user to enter into a form text box a large ammount of text. The data is entered into the PN database as type text. If I view the database via phpMySQL is shows the data formatted as I entered it, with linebreaks. When I retrieve the data from the database and view it in PostNuke, it is all just sequential data, no linebreaks.

    I have tried all forms of pnVarPrepHTMLDisplay and pnVarPrepForDisplay with no luck. I have been able to get it to display the HTML break tags themselves, but I want an actual line break. The HTML break tags are displayed when I use the following:

    Code

    $row[] = $output->Text(pnVarPrepHTMLDisplay(nl2br($batchitem['batch_recipe'])));


    Can someone please help me on this. If you need any code snipets, let me know and I can post what you need.

    Thanks,
    Kurt
  • Quote

    The HTML break tags are displayed when I use the following

    did you allow the break tag in administration-settings?

    --
    regards from germany
    ..::[Zikula Application Framework]::.. ..::[SEO-Blog]::.. ..::[CMS Sicherheit]::..
  • Quote

    did you allow the break tag in administration-settings?


    Yes, the break tag is the only tag that is allowed. Funny thing is that the linebreaks work as they should in the news articles. I tried to replicate the way the News module displays the body text of the articles, that's where I got the nl2br() idea, but it still doesn't work in my module.

    I'm pretty sure I'm submitting the data to the database correctly, as it shows up with linebreaks when I look at the data vi phpMySQL, it just doesn't display correctly in my module.

    Thanks for the help,
    Kurt
  • One way I do this is with:

    Code

    $output->SetInputMode(_PNH_VERBATIMINPUT);


    Everything else you've done looks right. I have always used: pnVarPrepForDisplay().
  • That did it. I guess I just needed the right combination of things to get it right. Thank you so much. Here's what I ended up with:

    Code

    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $row[] = $output->Text(pnVarPrepHTMLDisplay($batchitem['batch_recipe']));


    Thank you both again for your help.

    p.s. The module is pnWinery. It's initial purpose is to help me keep track of my batches of homemade wine, recipes, dates, etc. Hopefully it'll progress into something that others can use. I just started on it last weekend. Once I get it to a semi-ready for public state I'll register the project and share it out.

    Thanks again,
    Kurt

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