Skip to content

Options line within PHP #321

Answered by jekuer
melTr asked this question in Q&A
Discussion options

You must be logged in to vote

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:

function BoutonCalendar (Page $item) {
  $optionsDefault = "'Apple','Google','iCal','Outlook.com','Yahoo'";
  $out = '';
  $out .= '<add-to-calendar-button name="' . $item->title . '" options="' . $optionsDefault . '"';
  
  return $out;
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jekuer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants