Fantasier
Forum Replies Created
-
Forum: Plugins
In reply to: [Kommiku] [Plugin: Kommiku] ChangingI’m not Anraiki but I think I can answer you with my little knowledge about PHP.
I may wrote something wrong so you should copy all of your code in “kommiku.php” file before edit it ??
Connect to your website through FTP. Open your plugins Folder and select Kommiku. You’ll see the “kommiku.php” file. Download and Open it with Text Editor programs (like Notepad, EditPlus etc.) and add this function on the top of all code.
function plural($num) { if ($num != 1) return "s"; } function getRelativeTime($date) { $diff = time() - $date; $diff = round($diff/86400); if ($diff<7) { if($diff!=0) { return $diff . " day" . plural($diff) . " ago"; } else { return "Today"; } } else { return date('M jS,Y',$date); } }
Then find (It should be in 1039th line or around that).
if($chapter_list) foreach ($chapter_list as $row) {
And look at $date line, Change ‘m/d’ to ‘U’ So it should be like this.
$date = date( 'U', strtotime($row->date) );
Press Enter to make new line and add this code
$showdate = getRelativeTime($date);
Lastly, Change “$date” to “$showdate” in the following line.
$kommiku['chapter_list'] .= '<li><small>['.$showdate.']</small> <a ...(blablabla)
That’s all. Your code should be like this now.
if($chapter_list) foreach ($chapter_list as $row) { $date = date( 'U', strtotime($row->date) ); $showdate = getRelativeTime($date); $kommiku['chapter_list'] .= '<li><small>['.$showdate.']</small> ...(and blablabla)
and on the top off all code should have that function.
This code will show “Today”. If the time you uploaded the chapter is on today. And It will show …days ago if it’s not today. But If it’s more than 6 days ago it will show mm-dd-yy like you want.
If you don’t want to let it show …days ago. I mean, If you just want to check that it’s today or not. So you have to use this code as the function instead.
function plural($num) { if ($num != 1) return "s"; } function getRelativeTime($date) { $diff = time() - $date; $diff = round($diff/86400); if ($diff==0) { return "Today"; } else { return date('M jS,Y',$date); } }
I hope this can help you =). I’m not a good english speaker so sorry for my bad grammar.
PS.The getRelativeTime function. I edited from the function here
Forum: Plugins
In reply to: [Kommiku] [Plugin: Kommiku] About Dumping a chapterAh! I got it now. It’s because of my PHP Max Upload Value (It’s 8 MB). I’ve changed it by changing .htaccess now =) (I can’t access php.ini)
Thanks you very much!
If found where to add recent updates box (I didn’t think there’s a widget for me lol). Sorry, I’m stupid so … I have only two questions now.
A bit more ?? I forgot to ask.
How can I make a Recent Updates page or box (again, like TheTosho lol) . Can you tell me ? (if it’s possible). and if you think it’s too hard to do for me. Are you going to add this Feature in next version of this plugin ?
..And there’s no more question from me.
Thanks in advance!