[edit] this may be moved to a different thread, i found quite a few with a "permalink" subjcet [edit 2]I guess that "$RowNumber" maybe already used, grep found it everywhere. I changed it to $RowNumberPerm and now everything is fine; of course i had to add if (!$RowNumberPerm) { $RowNumberPerm=1; } otherwise 0 would have been the starting number.
Hi, today I tried to translate "Comments Permalinks" and some other Add-ons, too, into German and noticed most of them use the "old style" for declaring the language variables.
So I made a convertion (with the help of "sed" described here) to use the documented "new style" for the "Comments Permalinks" extension. If you want (an I recommend it) you can download the patch or/and the new "default.php" from my site at http://sokai.name/code/vanilla/add-ons/.
I wanted a truly permanent link so I suggest this code I test in some forums.
This is interpolated from Comments Permalinks 1.0 and Comment Links 1.3.2
CommentLink 1.0
<?php
/*
Extension Name: CommentLink
Extension Url: http://lussumo.com/docs/
Description: Adds an absolute "permalink" link to every comment, so you can share a single comment's url.
Version: 1.0
Author: Philippe Hilsz
Author Url: http://hilsz.com/
You should cut & paste this language definition into your
conf/your_language.php file (replace "your_language" with your chosen language,
of course):
*/
$Context->Dictionary['Permalink'] = 'permalink';
function CommentGrid_Permalinks(&$CommentGrid) {
$Context = &$CommentGrid->Context;
$Comment = &$CommentGrid->DelegateParameters['Comment']; $cid = $Comment->CommentID; $did = $Comment->DiscussionID;
$Link = $Context->Configuration['BASE_URL'] .'comments.php?' . 'DiscussionID='. $did . '&Focus='. $cid .'#Comment_' . $cid ;
$CommentList = &$CommentGrid->DelegateParameters["CommentList"];
$CommentList .= '<a href="'. $Link .'">' . $CommentGrid->Context->GetDefinition("Permalink").'</a>';
}
$Context->AddToDelegate("CommentGrid", "PostCommentOptionsRender", "CommentGrid_Permalinks");
?>
Comments
http://www.subdays.de/forum/comments.php?DiscussionID=6892&Focus=153029#Item_44
The funny thing is, the Commentnumber in "#Item_" is ALWAYS 'doubled'; #Item_22 would be
correct in this case.
My workaround:
I am changing it to
http://www.subdays.de/forum/comments.php?DiscussionID=6892&Focus=153029#Comment_153029
[edit] this may be moved to a different thread, i found quite a few with a "permalink" subjcet
[edit 2]I guess that "$RowNumber" maybe already used, grep found it everywhere. I changed it to $RowNumberPerm and now everything is fine; of course i had to add
if (!$RowNumberPerm) { $RowNumberPerm=1; }
otherwise 0 would have been the starting number.
today I tried to translate "Comments Permalinks" and some other Add-ons, too, into German and noticed most of them use the "old style" for declaring the language variables.
So I made a convertion (with the help of "sed" described here) to use the documented "new style" for the "Comments Permalinks" extension.
If you want (an I recommend it) you can download the patch or/and the new "default.php" from my site at http://sokai.name/code/vanilla/add-ons/.
For all German people: The translated text can be downloaded from http://sokai.name/code/vanilla/translation/.
Thanks a lot,
sokai
I updated the extension (and removed the typo in the name) and credited you as the principal author.