Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add an HTML class to a PHP script
    text
    copied!<p>First off, I don't know much (quite nothing) about PHP. I'm more familiar with CSS.</p> <p>I'm making use of Ben Ward script Tumblr2Wordpress (here's the script on <a href="http://github.com/BenWard/tumblr2wordpress" rel="nofollow">GitHub</a>) to export my Tumblr blog in XML (so I can import it in my Wordpress blog). This script reads tumblr's API, queries elements, do a bit of formatting and export the whole thing in HTML.</p> <p>I need to customize it just a bit to fit my needs. For example in the following function I need the blockquote to become a specific class of blockquote:</p> <pre><code>function _doBlockQuotes_callback($matches) { $bq = $matches[1]; # trim one level of quoting - trim whitespace-only lines $bq = preg_replace('/^[ ]*&gt;[ ]?|^[ ]+$/m', '', $bq); $bq = $this-&gt;runBlockGamut($bq); # recurse $bq = preg_replace('/^/m', " ", $bq); # These leading spaces cause problem with &lt;pre&gt; content, # so we need to fix that: $bq = preg_replace_callback('{(\s*&lt;pre&gt;.+?&lt;/pre&gt;)}sx', array(&amp;$this, '_doBlockQuotes_callback2'), $bq); return "\n". $this-&gt;hashBlock("&lt;blockquote&gt;\n$bq\n&lt;/blockquote&gt;")."\n\n"; } </code></pre> <p>At first, I thought it will be as simple as adding the class I need inside the blockquote HTML tag, like so <code>&lt;blockquote class="big"&gt;</code> But it breaks the code.</p> <p>Is there a way I could add this HTML attribute as is in the PHP script? Or do I need to define the output of this <code>&lt;blockquote&gt;</code>somewhere else?</p> <p>Thanks in advance for any tips!</p> <p>P.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload