Not signed in (Sign In)

Categories

Vanilla 1.1.4 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.
    • CommentAuthorMark W
    • CommentTimeMar 5th 2007
     # 1
    I'd been using ↑↓Ω for Sticky, Sunk and Closed. But now I can't change them in Vanilla 1.1.1?
    •  
      CommentAuthorMark
    • CommentTimeMar 5th 2007 edited
     # 2
    They have been moved to the language dictionary in an effort to make Vanilla a truly multilingual application.

    You can edit them by adding the following lines to your conf/language.php file:

    // change as required...
    $Context->Dictionary['TextWhispered'] = 'Private';
    $Context->Dictionary['TextSticky'] = 'Sticky';
    $Context->Dictionary['TextClosed'] = 'Closed';
    $Context->Dictionary['TextHidden'] = 'Deleted';
    $Context->Dictionary['TextSink'] = 'Sink';
    $Context->Dictionary['TextBookmarked'] = 'Bookmarked';
    $Context->Dictionary['TextPrefix'] = '[';
    $Context->Dictionary['TextSuffix'] = ']';


    This change means that you can also specify an image instead of characters if you like. You could do that by changing one of those settings to something like this:

    $Context->Dictionary['TextBookmarked'] = '<img src="ico.bookmark.gif" />';
    • CommentAuthorMark W
    • CommentTimeMar 5th 2007
     # 3
    Sweet. Thanks.
    • CommentAuthorMark W
    • CommentTimeMar 5th 2007 edited
     # 4
    (Note to self: Save text file as UTF-8 and upload as ASCII.)
    •  
      CommentAuthor[-Stash-]
    • CommentTimeMar 6th 2007
     # 5
    I've added this to the FAQ as I've wondered about this before, and I'm pretty sure that I've seen numerous other people ask this question. Now that it's so easy to do, everyone should be able to find out (and I want to remember) :)
    • CommentAuthorInkscape
    • CommentTimeMar 16th 2007 edited
     # 6
    Back in the days of v.1.0.3 I used Wallphones method to display little images for sticky, bookmarked, ...

    Now I updated to v.1.1.2 and used Mark's recommended method by adding s.th like this to /conf/language.php
    $Context->Dictionary['TextBookmarked'] = '<img src="ico.bookmark.gif" />';

    The result looks like this:
    Image Hosted by ImageShack.us

    I hope you see the problem. WallPhone used a changed function DiscussionPrefix within Vanilla.Functions.php. But when I change this function to WallPhones one, it doesn't work anymore with version 1.1.2
    My question is, what do I have to change, so that I get rid of the comma, and that all images are aligned side by side.
    •  
      CommentAuthorWallPhone
    • CommentTimeMar 16th 2007 edited
     # 7
    Thinking about this, its probably better to package this funtion in a theme file and droping it in your Themes/Vanilla folder so that it doesn't get overwritten by updates.

    Copy /themes/discussion.php into the Vanilla folder you see in /themes/, then copy and paste the DiscussionPrefix function inside it, just below the comments. Rename the function to something else... like NewDiscussionPrefix.

    Now remove all the lines that end with $Prefix .= ', ';--yes, the whole line. They are the longer of the line pairs inside the function. We don't need no stinkin' commas!

    And finally, go about 5-8 lines into the theme file and change the call to DiscussionPrefix already there to the name NewDiscussionPrefix.
    •  
      CommentAuthorWallPhone
    • CommentTimeMar 16th 2007
     # 8
    You should end up with something like this:

    <?php
    // Note: This file is included from the library/Vanilla/Vanilla.Control.SearchForm.php
    // class and also from the library/Vanilla/Vanilla.Control.DiscussionForm.php's
    // themes/discussions.php include template.

    $UnreadUrl = GetUnreadQuerystring($Discussion, $this->Context->Configuration, $CurrentUserJumpToLastCommentPref);
    $NewUrl = GetUnreadQuerystring($Discussion, $this->Context->Configuration, 1);
    $LastUrl = GetLastCommentQuerystring($Discussion, $this->Context->Configuration, $CurrentUserJumpToLastCommentPref);

    function NewDiscussionPrefix(&$Context, &$Discussion) {
    $Prefix = '';
    if (!$Discussion->Active) $Prefix = $Context->GetDefinition('TextHidden');
    if ($Discussion->Sticky) $Prefix .= $Context->GetDefinition('TextSticky');
    if ($Discussion->Closed) $Prefix .= $Context->GetDefinition('TextClosed');
    if ($Discussion->Bookmarked) $Prefix .= $Context->GetDefinition('TextBookmarked');
    if ($Discussion->Sink) $Prefix .= $Context->GetDefinition('TextSink');
    if ($Discussion->WhisperUserID > 0) $Prefix .= $Context->GetDefinition('TextWhispered');

    if ($Prefix != '') return $Context->GetDefinition('TextPrefix').$Prefix.$Context->GetDefinition('TextSuffix').' ';
    }

    $DiscussionList .= '
    <li id="Discussion_'.$Discussion->DiscussionID.'" class="Discussion'.$Discussion->Status.($Discussion->CountComments == 1?' NoReplies':'').($this->Context->Configuration['USE_CATEGORIES'] ? ' Category_'.$Discussion->CategoryID:'').($Alternate ? ' Alternate' : '').'">
    <ul>
    <li class="DiscussionType">
    <span>'.$this->Context->GetDefinition('DiscussionType').'</span>'.NewDiscussionPrefix($this->Context, $Discussion).'
    </li> .... <rest of theme file continues -->
    •  
      CommentAuthor[-Stash-]
    • CommentTimeMar 16th 2007
     # 9
    Could this be done as an extension so as to not limit your use of themes or is it so different for each theme that you may as well do this?
    •  
      CommentAuthorWallPhone
    • CommentTimeMar 16th 2007
     # 10
    I suppose this could be an extension, but this is easier than attaching to the delegate later in that theme file and parsing out the commas.

    On second thought, extensions are easier for users than editing core themes. o_0

    If enough people want it, I can spit out an extension.
    • CommentAuthorInkscape
    • CommentTimeMar 16th 2007 edited
     # 11
    Hi WallPhone,

    I followed your instructions, but after uploading and refresing all I see is:

    Fatal error: Cannot redeclare newdiscussionprefix() (previously declared in
    /www/sites/test.inkscapeforum.de/themes/vanilla/discussion.php:10) in
    /www/sites/test.inkscapeforum.de/themes/vanilla/discussion.php on line 10


    The discussion.php within the /themes/vanilla/ subfolder looks like this:
    <?php
    // Note: This file is included from the library/Vanilla/Vanilla.Control.SearchForm.php
    // class and also from the library/Vanilla/Vanilla.Control.DiscussionForm.php's
    // themes/discussions.php include template.

    $UnreadUrl = GetUnreadQuerystring($Discussion, $this->Context->Configuration, $CurrentUserJumpToLastCommentPref);
    $NewUrl = GetUnreadQuerystring($Discussion, $this->Context->Configuration, 1);
    $LastUrl = GetLastCommentQuerystring($Discussion, $this->Context->Configuration, $CurrentUserJumpToLastCommentPref);

    function NewDiscussionPrefix(&$Context, &$Discussion) {
    $Prefix = '';
    if (!$Discussion->Active) $Prefix = $Context->GetDefinition('TextHidden');
    if ($Discussion->Sticky) $Prefix .= $Context->GetDefinition('TextSticky');
    if ($Discussion->Closed) $Prefix .= $Context->GetDefinition('TextClosed');
    if ($Discussion->Bookmarked) $Prefix .= $Context->GetDefinition('TextBookmarked');
    if ($Discussion->Sink) $Prefix .= $Context->GetDefinition('TextSink');
    if ($Discussion->WhisperUserID > 0) $Prefix .= $Context->GetDefinition('TextWhispered');

    if ($Prefix != '') return $Context->GetDefinition('TextPrefix').$Prefix.$Context->GetDefinition('TextSuffix').' ';
    }

    $DiscussionList .= '
    <li id="Discussion_'.$Discussion->DiscussionID.'" class="Discussion'.$Discussion->Status.($Discussion->CountComments == 1?' NoReplies':'').($this->Context->Configuration['USE_CATEGORIES'] ? ' Category_'.$Discussion->CategoryID:'').($Alternate ? ' Alternate' : '').'">
    <ul>
    <li class="DiscussionType">
    <span>'.$this->Context->GetDefinition('DiscussionType').'</span>'.NewDiscussionPrefix($this->Context, $Discussion).'
    ...
    •  
      CommentAuthorWallPhone
    • CommentTimeMar 16th 2007
     # 12
    ::slaps forehead::

    The theme file is included multiple times, so PHP thinks the function is trying redefine itself.

    Wrap it in a check if it already exists like this:if (!function_exists('NewDiscussionPrefix')) {
    function NewDiscussionPrefix(&$Context, &$Discussion) {
    $Prefix = '';
    if (!$Discussion->Active) $Prefix = $Context->GetDefinition('TextHidden');
    if ($Discussion->Sticky) $Prefix .= $Context->GetDefinition('TextSticky');
    if ($Discussion->Closed) $Prefix .= $Context->GetDefinition('TextClosed');
    if ($Discussion->Bookmarked) $Prefix .= $Context->GetDefinition('TextBookmarked');
    if ($Discussion->Sink) $Prefix .= $Context->GetDefinition('TextSink');
    if ($Discussion->WhisperUserID > 0) $Prefix .= $Context->GetDefinition('TextWhispered');

    if ($Prefix != '') return $Context->GetDefinition('TextPrefix').$Prefix.$Context->GetDefinition('TextSuffix').' ';
    }
    }
    • CommentAuthorInkscape
    • CommentTimeMar 16th 2007
     # 13
    Works like a charm. Thanks very, very much, Wallphone. :)
    •  
      CommentAuthor[-Stash-]
    • CommentTimeMar 16th 2007
     # 14
    First update Pimped my Vanilla, then make this an extension ;)
    • CommentAuthorHerrgeist
    • CommentTimeJul 20th 2007 edited
     # 15
    I cannot get the image to replace the text. I even tried just changing the [Sticky] text and it didnt work. What am I doing wrong? I'm using v1.1.2

    would that make a difference?
    • CommentAuthorHerrgeist
    • CommentTimeJul 21st 2007
     # 16
    I pasted the text that Mark gave above into the languages file under the conf folder, but maybe I didn't do it right. is this still the proper method?
    •  
      CommentAuthorVaz
    • CommentTimeSep 27th 2007 edited
     # 17
    Sorry for the late reply, yes it still is. I've just tried it and it works. A stupid mistake I made was that I had the images in the wrong location. Then I got it working by making it like:

    $Context->Dictionary['TextWhispered'] = '<img src="http://www.xxxxxx.com/img/buttons/private.png" />';
    $Context->Dictionary['TextSticky'] = '<img src="http://www.xxxxxxx.com/img/buttons/sticky.png" />';

    (with full urls).

    also guys, I'm getting the same problem as InkScape and I'm finding the solution provided by wallphone a little hard to follow. Could someone clear things up for me please?

    What lines do I delete/what lines do I add & where abouts?
    •  
      CommentAuthorVaz
    • CommentTimeSep 30th 2007
     # 18
    bump
    • CommentAuthormburns
    • CommentTimeJan 20th 2008
     # 19
    If there is still interest, I would find this (in extension form, ideally) really useful. I'm looking to deploy several multilingual forums, and having images depict actions instead of words is a good thing and 2. upgrading multiple installations will make using a bit tricky, as mentioned in the thread.
  1.  # 20
    I still get a set of empty brackets above the newly placed image [] any ideas how to remove them?
Add your comments
    Username Password
  • Format comments as