Forums

How to decode HTML readd from database

NickOg 05 Jul, 2017
Hi
I have done this with CF5 but can't workout the CF6 equivalent.
I read a record from mySQL that contains some HTML.
Using {var/pr:read_data8.mdlBrochureHeader.brochureHeader} I get this
.
<h2 style="text-align: center;"><strong>PMHU3A COURSES &ndash; TERM 2, 2017</strong></h2>
<p><strong>Enrolments</strong> ON LINE enrolment will be available from midnight April 23rd. <br /><strong>PORT MACQUARIE OFFICE</strong> : 9:30 am &ndash; 3:30 pm Monday April 24th &amp; Wednesday 26 to Friday 28th April<br /><strong><span style="color: #ff0000;">Note: Closed Tuesday 25th - Anzac Day</span></strong><br /><strong>LAURIETON</strong>: 10:30 &ndash; 12 noon Monday April 24th Laurieton United Service Club (LUSC). <strong>WAUCHOPE</strong>: No enrolment <br /><strong>Courses Venue</strong>: PMHU3A Centre, Lochinvar Place PM unless otherwise stated <strong>Phone</strong>: 6584 4192<br /><strong>PLEASE NOTE</strong>: PORT MACQUARIE courses are in black text;<span style="color: #0000ff;"> LAURIETON in blue text</span><br /><strong>GENERAL DISCLAIMER</strong>: Most activities involve some element of risk. Cycling, in particular, is an inherently dangerous activity and requires an appropriate level of fitness. While U3A maintains public liability insurance and will endeavour to protect your safety, it cannot remove all the dangers. It assumes that participants, by booking, consider themselves to have appropriate levels of fi tness and mobility. Those undertaking activities should therefore be aware that they participate at their own risk.</p>


And using
<div>{var:read_data8.mdlBrochureHeader.brochureHeader}</div>
I get this
<h2 style="text-align: center;"><strong>PMHU3A COURSES – TERM 2, 2017</strong></h2> <p><strong>Enrolments</strong> ON LINE enrolment will be available from midnight April 23rd. <br /><strong>PORT MACQUARIE OFFICE</strong> : 9:30 am – 3:30 pm Monday April 24th & Wednesday 26 to Friday 28th April<br /><strong><span style="color: #ff0000;">Note: Closed Tuesday 25th - Anzac Day</span></strong><br /><strong>LAURIETON</strong>: 10:30 – 12 noon Monday April 24th Laurieton United Service Club (LUSC). <strong>WAUCHOPE</strong>: No enrolment <br /><strong>Courses Venue</strong>: PMHU3A Centre, Lochinvar Place PM unless otherwise stated <strong>Phone</strong>: 6584 4192<br /><strong>PLEASE NOTE</strong>: PORT MACQUARIE courses are in black text;<span style="color: #0000ff;"> LAURIETON in blue text</span><br /><strong>GENERAL DISCLAIMER</strong>: Most activities involve some element of risk. Cycling, in particular, is an inherently dangerous activity and requires an appropriate level of fitness. While U3A maintains public liability insurance and will endeavour to protect your safety, it cannot remove all the dangers. It assumes that participants, by booking, consider themselves to have appropriate levels of fitness and mobility. Those undertaking activities should therefore be aware that they participate at their own risk.</p>


What I need of course is for that html text to be decoded and displayed. In CF 5 I used
<div class="brochureHeader"><?php echo htmlspecialchars_decode($objResult->brochureHeader); ?></div>


but I can't get that to work with Cf6. what am i missing???

Regards

Nick
NickOg 06 Jul, 2017
Answer
No idea why I was struggling with this.

Solution - as an HTML block in Designer
<?php    $mdlBrochureHeader= $this->get("read_data8"); ?>
<div class="brochureHeader"><?php echo htmlspecialchars_decode($mdlBrochureHeader['mdlBrochureHeader']['brochureHeader']); ?></div>
This topic is locked and no more replies can be posted.