TinyButStrong - the PHP Template Engine
Categories > OpenTBS with ODT >

Rendering of HMTL stored in my database records

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

Date: 2016-09-22
Time: 10:49

Rendering of HMTL stored in my database records


I am using OpenTBS to generate PDF pages using an ODT template. In the ODT template, I embed variables like "NAME" / "SURNAME" / "EMAIL" and so on : the PDF generated will display one page per contact stored in my database, each page displaying the name / surname / email of each contact. That works fine, with a line-break between each page to separate each contact on one page.
My problem now :
- I have a field in my database called "Your information"
- where my contacts describe their professional activity and
- they often use HTML tag (bold, underline, italic etc) to enhance their writing
- the HTML tag are stored in the field "Your information"
=> how can I get the HTML tags to properly display in the PDF ? At the moment, the PDF shows the HTML tags as writing

Thanks for any help
By: Skrol29
Date: 2016-09-27
Time: 09:40

Re: Rendering of HMTL stored in my database records


That's the problem of storing rich text (bold, underline, italic, ...) with a final format (HTML).
That's also why some software store riche text in a simplified format (like BBcode).

It would be quite difficult, probably impossible, to perform a function that fully translates HTML to ODT.
I simple solution is simply to use the PHP function strip_tags() in order to delete HTML tags keeping the text.
A more complicated solution is to start a function that does some translation from HTML to ODT but you have to make it.