- Posts: 2
COMMUNITY FORUM
K2 archive tools display
- meysam hosseini
-
Topic Author
- Offline
- New Member
Less
More
10 years 6 months ago #133476
by meysam hosseini
K2 archive tools display was created by meysam hosseini
Hi
Is it possible to show items like that:
last month - last 3 month - last 6 month
in k2 archive, you can display items by month, but i want to show items by last 3 month for example.
how can i do that?
Best regard.
Is it possible to show items like that:
last month - last 3 month - last 6 month
in k2 archive, you can display items by month, but i want to show items by last 3 month for example.
how can i do that?
Best regard.
Please Log in or Create an account to join the conversation.
- Buy Lei D (買呢D)
-
- Offline
- New Member
Less
More
- Posts: 11
10 years 6 months ago #133477
by Buy Lei D (買呢D)
Replied by Buy Lei D (買呢D) on topic Re: K2 archive tools display
1.Edit (your joomla file)/modules/mod_k2_tools/tmpl/archive.php
2.Find out the line "<?php echo $month->name.' '.$month->y?>"
3.If you still want to keep the origin format displaying the achivement,keep it, otherwise you may following code
<?php
$itemDate = $month->m;
$today = getdate();
$m = $today["mon"]-$itemDate;
if($d>1){
echo "Last ".$m." months ago.";
}else{
echo "Last ".$m." month ago.";
}
?>
and you will see "Last 1 month ago.", "Last 2 months ago.","Last 3 months ago." etc.
2.Find out the line "<?php echo $month->name.' '.$month->y?>"
3.If you still want to keep the origin format displaying the achivement,keep it, otherwise you may following code
<?php
$itemDate = $month->m;
$today = getdate();
$m = $today["mon"]-$itemDate;
if($d>1){
echo "Last ".$m." months ago.";
}else{
echo "Last ".$m." month ago.";
}
?>
and you will see "Last 1 month ago.", "Last 2 months ago.","Last 3 months ago." etc.
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
Less
More
- Posts: 8743
10 years 6 months ago #133478
by Lefteris
Replied by Lefteris on topic Re: K2 archive tools display
@meysam hosseini
Do not create duplicate posts or you will get banned from the site. I already answered to you that this cannot be done. Even if you apply the code that @Buy Lei D (買呢D) provided the links will not work properly. You will get links to the specific months not to a range of months.
Do not create duplicate posts or you will get banned from the site. I already answered to you that this cannot be done. Even if you apply the code that @Buy Lei D (買呢D) provided the links will not work properly. You will get links to the specific months not to a range of months.
Please Log in or Create an account to join the conversation.
- Buy Lei D (買呢D)
-
- Offline
- New Member
Less
More
- Posts: 11
10 years 6 months ago #133479
by Buy Lei D (買呢D)
Replied by Buy Lei D (買呢D) on topic Re: K2 archive tools display
@Lefteris Kavadas
I am sorry that my reply may make some one confused.
And the theory of my code just comparing the user system time and the item create time to make the display like "Last X months ago."
I dont know what if it will affact on the structure or the stability of K2 tool.
I am sorry that my reply may make some one confused.
And the theory of my code just comparing the user system time and the item create time to make the display like "Last X months ago."
I dont know what if it will affact on the structure or the stability of K2 tool.
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
Less
More
- Posts: 8743
10 years 6 months ago #133480
by Lefteris
Replied by Lefteris on topic Re: K2 archive tools display
@Buy Lei D (買呢D)
It's fine, there is no reason to be sorry. Actually we want our members to try to help others. Your code will display the months correctly but as i wrote above these links will not work as expected. But there is nothing wrong in trying to help others.
It's fine, there is no reason to be sorry. Actually we want our members to try to help others. Your code will display the months correctly but as i wrote above these links will not work as expected. But there is nothing wrong in trying to help others.
Please Log in or Create an account to join the conversation.