0
foreach ($results as $row) {
    $eventobj = new ZCiCalNode("VEVENT", $icalobj->curnode);
    //$summary = substr($row['PROBLEM'], 0, 30); 
    $eventobj->addNode(new ZCiCalDataNode("SUMMARY:" . substr($row["COMPANY"],0,17) ." " ."[" .substr($row['PROBLEM'], 0, 30) ."]"));
    $eventobj->addNode(new ZCiCalDataNode("DTSTART:" . ZCiCal::fromSqlDateTime($row['STARTDATE'])));
    $eventobj->addNode(new ZCiCalDataNode("DTEND:" . ZCiCal::fromSqlDateTime($row['ENDDATE'])));
    $eventobj->addNode(new ZCiCalDataNode("UID:" . date('Y-m-d-H-i-s'). "-" . $count . "@mxsip.com"));
    $eventobj->addNode(new ZCiCalDataNode("DTSTAMP:" . ZCiCal::fromSqlDateTime()));
    $eventobj->addNode(new ZCiCalDataNode("SUMMARY:" . $row["COMPANY"]));
    $eventobj->addNode(new ZCiCalDataNode("LOCATION:" . $row['ADDRESS'] . ',' . $row['CITY'] . ',' . $row['ZIP']));
    $eventobj->addNode(new ZCiCalDataNode("Description:X-ALT-DESC;FMTTYPE=text/html" . ZCiCal::formatContent(
        $row["COMPANY"] ."\r\n" 
        ."-----------------" ."\r\n" 
        . $row['PROBLEM'] . "\r\n" 
        ."-----------------" ."\r\n" 
        . $row['DETAIL']. "\r\n" 
        ."-----------------" ."\r\n"
        . "Site Contact: " . $row['CONTACT']. "\r\n" 
        . "Office Number: " . $row['PHONE']. "\r\n" 
        //. "Mobile Number: " . $row['MOBILE']. "\r\n" 
        . "Email: " . $row['EMAILADDRESS']. "\r\n" 
        ."-----------------" ."\r\n"
        . "https://". $row['URL'] . "/controller.php?action=" . $row['DISP_TYPE'] . $row['DISPATCHNO']
    )));
    $count = $count + 1;
}

how do i write html inside my php code? I want to make the Description (in the event of the ics file that is generated )bold using html. I want to see the values fetched (from a database) for COMPANY, PROBLEM etc. up to EMAIL ,bolded.

Professor Abronsius
  • 33,063
  • 5
  • 32
  • 46
  • Html is just text, so just add it to the string you've already got. It's a bit unclear how/where you're stuck. Have you tried anything? – ADyson Aug 26 '23 at 07:59
  • Can you show how? I will run the code and see if it works. Yes I tried, but I dunno how to write the syntax. – Leonidas Aug 27 '23 at 20:14
  • Like I said, html is just text. So if you want some html in your description text, just type it in within a string. For example `$eventobj->addNode(new ZCiCalDataNode("Description:X-ALT-DESC;FMTTYPE=text/html" . ZCiCal::formatContent("". $row["COMPANY"] ."\r\n"`...something like that. – ADyson Aug 27 '23 at 21:28
  • P.s. you should realise that in a html document, a new lines is created using a `
    ` tag, not `\r\n`
    – ADyson Aug 27 '23 at 21:29
  • i tried what you commented, but in the result it is only displaying as plain text and not actually giving the description in bold. For example, I mean i want to see just the company name as "XYZ Corporation" all in bold when i do "Description:X-ALT-DESC;FMTTYPE=text/html" . ZCiCal::formatContent("". $row["COMPANY"] ."\r\n". But instead I m seeing "X-ALT-DESC;FMTTYPE=text/htmlXYZ Corporation as plain text. P.S. : The value of the ["COMPANY"] is fetched from a database. – Leonidas Aug 28 '23 at 13:01
  • p.s: The value fetched ,"XYZ Corporation" is bolded but it still displays the actual X-ALT... property alongside ,in the description box of the event on google calendar. – Leonidas Aug 28 '23 at 13:11
  • Well you've got the html in there, but it doesn't mean that everyone supports it. Did you do any research? Html support in iCal files is varied. See https://stackoverflow.com/a/41307292/5947043 or https://www.limilabs.com/blog/html-formatted-content-in-the-description-field-of-an-icalendar . https://www.google.com/search?q=ics+file+html+body for more results. Basically, it looks like only Outlook supports this feature fully. – ADyson Aug 28 '23 at 14:10
  • 1
    Thanks, this makes it clear! Appreciate the help. Google cal does support the html in ical files but thunderbird doesn't support it. I am getting what i wanted in the google cal atleast. – Leonidas Aug 28 '23 at 15:03

0 Answers0