Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

How to modify <code></code> function

VazVaz New
edited November 2007 in Vanilla 1.0 Help
Hi guys, I'd like to edit the <code> function. Could someone direct me to where I'd find it? I'd like to edit the function so it adds the following text around the tags: <dl><dt><a href="#" onclick="selectCode(this); return false;">Select all</a></dt><dd> & </dd></dl> So: <dl><dt><a href="#" onclick="selectCode(this); return false;">Select all</a></dt><dd> <code>MY TEXT GOES HERE</code> </dd></dl>

Comments

  • Options
    Hi, are you talking about the HTML formatter?
  • Options
    VazVaz New
    edited November 2007
    nope, just the default function which allows me to do

    this

    Can I just achieve my goal by making an edit to the css?
  • Options
    I think that what you just used is the HTML formatter that is installed here (try without!). And I don't think you'll be able to add tags with css.
  • Options
    Ah yep, that's it.
  • Options
    NickENickE New
    edited November 2007
    in the html formatter you should see a function call that looks like this:$String = preg_replace( array( '/<code((?>[^>]*))>(.+?)<\/code(?>[^>]*)>/sei', '/<(?![A-Za-z\/'.(HTML_ALLOW_COMMENTS?'!':'').'])/i' ), //yet again, order is important array( '\'<code\'.$this->RemoveQuoteSlashes(\'\1\').\'>\'.htmlspecialchars($this->RemoveQuoteSlashes(\'\2\')).\'<./code>\'', '<' ), $String );Edit what you want in the replacement array. In your case you'd want to change the first element to something like:'\'<dl><dt><a href="#" onclick="selectCode(this); return false;">Select All</a></dt><dd><code\'. $this->RemoveQuoteSlashes(\'\1\').\'>\'.htmlspecialchars($this->RemoveQuoteSlashes(\'\2\')).\'<./code></dd></dl>\'', (changing <./code> to </code>, obviously)
This discussion has been closed.