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.

Dictionaries/Languages in extension

KrakKrak New
edited July 2007 in Vanilla 1.0 Help
What is the proper term to use? I've looked in the wiki and was a little confused. I have also dug through some extensions and noticed a few different methods. For the life of me i can not get them to work (in my hidden text extension). I have tried a few ways and can't get it. I am sure I am missing something small and stupid. Any ideas?

Comments

  • edited July 2007
    Hi Krak, is the problem: "I can't display any text" or "I can't display the translation"?
    Like told on this page, I use
    $Context->SetDefinition('UniqueDefinitionName', 'The text string for the definition');
    and
    ... $Context->GetDefinition("UniqueDefinitionName") ...
    and it works fine. Could you post some come please?
  • I am using:
    $Context->SetDefinition('IamUnique', 'This is my message');

    And I am trying to get it to show using:
    $Replacements = array( '<span class="HiddenWarning"><a href="javascript:handleParent('.$RowNumber.')">('.$this->Context->GetDefinition('ContactFormNotes').')</a></span><div class="Hidden" id="'.$RowNumber.'">$1</div>', );
  • edited July 2007
    Quite strange snippets. I guess this is roughly what you coded (I guess you used the same key rather than IamUnique and ContactFormNotes).
    Could you try a simple extension with only this code in the default.php:
    // basic Vanilla declarations // ... $Context->SetDefinition('IamUnique', 'This is my message'); echo $Context->GetDefinition('IamUnique');
    Then try to separate those two lines until it breaks.
  • Yeah that works, but where I want to put it is where it breaks.

    Fatal error: Call to a member function on a non-object. Which is what my problem is, I figured it was something dumb I did (probably still is). It appears that it breaks when I stick it in a class. Works anywhere else but there. How would I get it to work form inside a class?
  • edited July 2007
    Maybe you have a problem with your context objet. Try something like
    class MyClass { var $Context; function MyClass(&$Context) { $this->Context = &$Context; // ... } // ... }
    The & is important since you want the grab the same Context object throughout the execution of Vanilla.
    Then you create your new object passing the $Context object to the constructor.
This discussion has been closed.