4images Forum & Community
4images Modifications / Modifikationen => Templates & Styles (Requests & Discussions) => Topic started by: edonai on August 18, 2009, 05:42:47 AM
-
Hello to all.
I would like to know how to display the time of upload in the MOD "new_images" ?
For example "5 hours ago" or "two days ago" etc..... ?
Thanks for your help
Edonai
-
That Great :) Even Im Waiting for a mod Like this :!: :wink:
-
where do you want this to be showed? on each image instead of full date?
-
Nice. ^^
I Waiting for this mod too!
-
where do you want this to be showed? on each image instead of full date?
On Signature MOD (http://www.4homepages.de/forum/index.php?topic=6755.msg139651#msg139651) please.
-
where do you want this to be showed? on each image instead of full date?
Yes V@no, like this : http://www.theanimegallery.com/ (it's a beautiful site by IGC !)
-
In includes/functions.php find:
$timezone_offset = (defined("TIME_OFFSET")) ? TIME_OFFSET : 0;
Insert above:
if (isset($user_info['date_alt']) && $user_info['date_alt'])
{
return format_date_alt($format, $timestamp);
}
Above ?> insert:
function format_date_alt($format, $timestamp) //based on duration function from http://snipplr.com/view.php?codeview&id=2711
{
global $user_info, $lang;
$t = time() - ($timestamp + (3600 * (defined("TIME_OFFSET") ? TIME_OFFSET : 0)));
$vals = array('y' => (int) ($t / 86400 / 365),
'o' => (int) ($t / 86400 / 30),
'w' => (int) ($t / 86400 / 7),
'd' => $t / 86400 % 7,
'h' => $t / 3600 % 24,
'm' => $t / 60 % 60,
's' => $t % 60);
$ret = array();
$added = false;
foreach ($vals as $k => $v)
{
if ($v > 0 || $added)
{
$added = true;
if ($v > 1)
{
$k = $lang['date_alt'][$k][1];
}
else
{
$k = $lang['date_alt'][$k][0];
}
$ret[] = $v . " " . $k;
}
}
return join(' ', $ret);
}
In index.php find:
$bgcounter = 0;
Insert below:
$user_info['date_alt'] = 1;
Find:
unset($new_images);
Insert below:
unset($user_info['date_alt']);
In lang/<your language>/main.php above ?> insert:
$lang['date_alt'] = array(
'y' => array("year", "years"),
'o' => array("month", "months"),
'w' => array("week", "weeks"),
'd' => array("day", "days"),
'h' => array("hour", "hours"),
'm' => array("minute", "minutes"),
's' => array("second", "seconds"),
);
-
Thank you, you are super!
i follow your instruction, but the display is incorrect :
(http://img200.imageshack.us/img200/1898/sanstitre1yvu.th.png) (http://img200.imageshack.us/i/sanstitre1yvu.png/)
I call the function with the following tag: {image_date}
-
ops, sorry, missed one step for main.php file..added in the instructions above.
-
Big thanks V@no, you're great! :P
-
Big THX V@no!
Added to my List: http://www.4homepages.de/forum/index.php?topic=24888.0