I've been working hard to replace all the shared code in posts on my website, but I'm having trouble getting it to work. I want everything inside
<pre><code></code></pre>
tags to be colorized using CSS. Here's a sample of the code I've been trying to use:
function Rep(text){
text = text.replace(/ /g," ");
text = text.replace(/<([^\>]+?)>/g, function(match, contents){
return "<span class='TagColor'><"+contents+"></span>";
}
);
// Additional code snippets here...
And this is how the code appears on my website:
<pre id="Mpreditor" class="code code-codes language-javascript">
<code ng-transclude="ng-transclude" class="language-javascript">
<span>Hello</span>
You have to include the `%` signs in the `$params`, not in the query:
$query = "SELECT * FROM tbl WHERE address LIKE ? OR address LIKE ?";
$params = array("%$var1%", "%$var2%");
$stmt = $handle->prepare($query);
$stmt->execute($params);
</code></pre>