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

variable included in extension gives 'Undefined' warning

edited September 2006 in Vanilla 1.0 Help
I'm doing a textformatter, I've included an array defining symbols stored in a global variable. This variable is passed as a parameter to a function call inside the Parse method. When calling the function, PHP warns that the variable is undefined, yet if I add an echo with the variable just before calling the funcion, it prints "array". The code works in a standalone PHP, by the way. Seems like a scope problem, but I'm lost and rather new to Vanilla. Any ideas? Any extra information I should provide? Thanks in advance, I'll post the extension to the repository once it's in working order Edit: eh.. another thing, apparently to render correctly I need to change the Doctype and to report mime-type as xml. I have no idea where this is done in Vanilla either, nor would I know where to begin looking for it.

Comments

  • Options
    Thy bumpeth? I signed in this forum hoping for some help understanding how to write extensions for Vanilla, but I get no replies whatsoever.. maybe no one is interested in posting mathematic formulas inside their forums? For the record, I got that working already.. all that is missing is symbol translation and doctype/mime for proper rendering, but the formulas are there already, in their own formatter.
  • Options
    Fixed it. It was just a silly scope problem, I never ran into them before because I never attempted to do a big app before, and never had to read a global from inside a function. C/C++ coder here. So. My remaining problem is the xml mimetype and doctype, I shall start a new thread for that one. When I get back later today. Cheers.
  • Options
    NickENickE New
    edited September 2006
    Hey cool, your a C programmer as well! Anyhow, the mimetypes you can find in appg/headers.php and the doctype is in themes/head.php
  • Options
    edited September 2006
    That did it, SirNot, you rock! I have now proper MathML displaying inline inside Vanilla forum posts =) now for the bad news. head.php had to be changed with this doctype and xml namespace (note that SVG is there, I plan to add that too later) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"> that aint so bad, since you can stuff it in a theme.... you'd have to have a theme that allows mathml and svg, and changing your current theme to reflect that aint so hard. On the other hand, appg/headers.php had to be changed too, and Mark recommends aganist it because this could be wiped when you update Vanilla. the changed line looks like this: // PROPERLY ENCODE THE CONTENT header ('content-type: application/xhtml+xml; charset='.$Configuration['CHARSET']); however, after changing that, the extension worked beautifully. Now I'll add the regexp to confine the parser to [math] tags and then I'll release it ^^ Thanks SirNot EDIT-------- Had to change a rogue ampersand in my langfile (castellano), since parsing becomes very strict (stricter than strict!) when you choose xml. Oh and IE, gotta love it, now wants to download the site. Yeah thats right. Refuses to open it. Any ideas? I'm kinda partial on turning down more than half of the visitors :s
  • Options
    edited September 2006
    figured I'd include a teaser pic ^^
    (ehm.. but I can't. So I'll just toss the link.)
    http://octavoarte.cl/foroconcurso/vanilla_mathml.jpg
This discussion has been closed.