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:
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)
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:
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.
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.
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.
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).'
...
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').' ';
}
}
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?
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?
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.
When the discussion is active there is NOT a icon before the discussion name how to change it?
EDIT:
When there is a new post how you can get there an icon
Example:"
When some one post a new post or start a discussion there must be an other icon
Comments
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" />';
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:
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.
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... likeNewDiscussionPrefix
.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.
<?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 -->
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).' ...
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').' '; } }
$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?