##Notes:
Notes:
Update:
#Update: AfterAfter the update to your question, you appear to want to have this value returned by the function in your question. You would need to adjust your function to return this value as a string. Something like this would probably work:
##Notes:
#Update: After the update to your question, you appear to want to have this value returned by the function in your question. You would need to adjust your function to return this value as a string. Something like this would probably work:
Notes:
Update:
After the update to your question, you appear to want to have this value returned by the function in your question. You would need to adjust your function to return this value as a string. Something like this would probably work:
- You might want to consider using the
<code></code>HTML tag instead because then you are explicitly stating that what is contained in that element is code and not anything else. It will also, by default, display the code in a different font. - You could use
htmlentities()instead ofhtmlspecialchars()depending on your circumstance. For more information check out this answer this answer
- You might want to consider using the
<code></code>HTML tag instead because then you are explicitly stating that what is contained in that element is code and not anything else. It will also, by default, display the code in a different font. - You could use
htmlentities()instead ofhtmlspecialchars()depending on your circumstance. For more information check out this answer
- You might want to consider using the
<code></code>HTML tag instead because then you are explicitly stating that what is contained in that element is code and not anything else. It will also, by default, display the code in a different font. - You could use
htmlentities()instead ofhtmlspecialchars()depending on your circumstance. For more information check out this answer
#Update: After the update to your question, you appear to want to have this value returned by the function in your question. You would need to adjust your function to return this value as a string. Something like this would probably work:
function searchbox_markup(){
$baseUrl = "example.com";
$snippet = "<script type='application/ld+json'>
{
'@context': 'http://schema.org',
'@type': 'WebSite',
'url': '".$baseUrl."',
'potentialAction': {
'@type': 'SearchAction',
'target': '".$baseUrl."'index.php?page=search&sPattern={search_term_string}',
'query-input': 'required name=search_term_string'
}
}
</script>";
return $snippet;
}
To me, this looks messy. There is almost certainly a better way of solving the problem that you are trying to fix.
#Update: After the update to your question, you appear to want to have this value returned by the function in your question. You would need to adjust your function to return this value as a string. Something like this would probably work:
function searchbox_markup(){
$baseUrl = "example.com";
$snippet = "<script type='application/ld+json'>
{
'@context': 'http://schema.org',
'@type': 'WebSite',
'url': '".$baseUrl."',
'potentialAction': {
'@type': 'SearchAction',
'target': '".$baseUrl."'index.php?page=search&sPattern={search_term_string}',
'query-input': 'required name=search_term_string'
}
}
</script>";
return $snippet;
}
To me, this looks messy. There is almost certainly a better way of solving the problem that you are trying to fix.