-
Hi, I tried many variations with ' or ", interchanging them. But either nothing appears (with PHP error about strings). If I put only one choice, the button work without problem; so the problem concerns ' or ". The function looks like this (I removed some config to keep minimal info): function BoutonCalendar (Page $item) {
$out ='';
$out .= '<add-to-calendar-button
name="{$item->title}"
options=" 'Apple','Google','iCal','Outlook.com','Yahoo' "
></add-to-calendar-button>';
return $out;
} Does someone already implement this script in PHP? EDIT: sorry, finally found the solution. In case, it helps someone : options='"Apple", "Google", "Outlook.com", "Yahoo", "ical"' |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Glad you solved it yourself. Basically, you need to make sure that you do not use any single or double quotes around the element, which could interfere with it. One strong solution in your case would look like this: function BoutonCalendar (Page $item) {
$optionsDefault = "'Apple','Google','iCal','Outlook.com','Yahoo'";
$out = '';
$out .= '<add-to-calendar-button name="' . $item->title . '" options="' . $optionsDefault . '"';
return $out;
} |
Beta Was this translation helpful? Give feedback.
Glad you solved it yourself.
Basically, you need to make sure that you do not use any single or double quotes around the element, which could interfere with it.
There are multiple ways of achieve this.
One strong solution in your case would look like this: