Not signed in (Sign In)

Categories

Vanilla 1.1.5 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    •  
      CommentAuthorzinor
    • CommentTimeJul 6th 2006
     # 1
    I'm curious as to if there is some way to change the "Format comments as" box in the options.

    Basically, I want to allow HTML, and Textile, but use both, and have no selection for anything :)
    •  
      CommentAuthorMark
    • CommentTimeJul 6th 2006 edited
     # 2
    Well, first you'd have to make your extension remove the text option from the StringManagers array.
    Then you'd have to write an extension that follows both the rules of html and textile.

    I imagine it would be something like this:


    // Remove all existing formatters from the StringManipulator object
    $Context->StringManipulator->Formatters = array();
    $Context->StringManipulator->GlobalFormatters = array();

    // Declare your new StringFormatter
    $Context->Dictionary["HTMLExtile"] = "HTMLExtile";

    class HTMLExtileFormatter extends StringFormatter {
    function Parse($String, $Object, $FormatPurpose) {
    // Do your string manipulation here...
    return $String;
    }
    }

    // Instantiate the formatter and add it to the context object's string manipulator
    $HTMLExtileFormatter = $Context->ObjectFactory->NewContextObject($Context, "HTMLExtileFormatter");
    $Context->StringManipulator->AddManipulator("HTMLExtile", $HTMLExtileFormatter);



    I haven't tested it, of course, but I'm pretty sure that will do it.
    •  
      CommentAuthorkalikiana
    • CommentTimeJul 6th 2006 edited
     # 3
    That looks just like the tutorial I followed while trying to make an extension... maybe it's worth a try to look at it again.
    • CommentAuthorlowbenzo
    • CommentTimeJul 7th 2006
     # 4
    have you got something similar to remove the text bullets and allow just BetterBBcode all the time?
    •  
      CommentAuthorDinoboff
    • CommentTimeSep 25th 2006 edited
     # 5
    •  
      CommentAuthorDinoboff
    • CommentTimeSep 26th 2006 edited
     # 6
    About the code Mark posted, it work fine if no comments have been post before with an other FormatType.
    With a previous text comment, you get this message:
    "Notice: Undefined index: Text in /path/to/library/Framework/Framework.Class.StringManipulator.php on line 98
    Fatal error: Call to a member function on a non-object in path/to/library/Framework/Framework.Class.StringManipulator.php on line 100".

    To fix it you just need to add in the extension:$Context->Configuration['DEFAULT_FORMAT_TYPE'] = 'HTMLExtile';
Add your comments
    Username Password
  • Format comments as