- Posts: 18
COMMUNITY FORUM
blog calendar doesn't pull from children categories
- fjesteban
-
- Offline
- New Member
Less
More
14 years 5 days ago #74329
by fjesteban
Replied by fjesteban on topic blog calendar doesn't pull from children categories
Grazie mile!
Here's my K2 powered site. As you'll see, it contains some other hacks:
www.uco.es/servicios/comunicacion/actualidad
Here's my K2 powered site. As you'll see, it contains some other hacks:
www.uco.es/servicios/comunicacion/actualidad
Please Log in or Create an account to join the conversation.
- Shapes
-
- Offline
- Junior Member
Less
More
- Posts: 30
13 years 8 months ago #74330
by Shapes
Replied by Shapes on topic blog calendar doesn't pull from children categories
Hello,
This hack seems great, and just what I need, but...
What version of K2 are you using ?
I tried the hack, but all i'm getting is a blank page after altering hlper.php using K2 v2.4.1...
Hoping for answers,
Best regards,
David aka Shapes
This hack seems great, and just what I need, but...
What version of K2 are you using ?
I tried the hack, but all i'm getting is a blank page after altering hlper.php using K2 v2.4.1...
Hoping for answers,
Best regards,
David aka Shapes
Please Log in or Create an account to join the conversation.
- Edu Cantero
-
- Offline
- New Member
Less
More
- Posts: 7
13 years 6 months ago #74331
by Edu Cantero
Replied by Edu Cantero on topic blog calendar doesn't pull from children categories
does not work for me :(. Could you help me with this, please?
(No me funciona. ¿Me podrías echar un cable por favor?)
(No me funciona. ¿Me podrías echar un cable por favor?)
Please Log in or Create an account to join the conversation.
- fjesteban
-
- Offline
- New Member
Less
More
- Posts: 18
13 years 6 months ago #74332
by fjesteban
Replied by fjesteban on topic blog calendar doesn't pull from children categories
Of course!
There's been serveral versions from the one I made this hack. Perhap's it's no longer applicable. Could you please turn on PHP debugging in your site and post the error log after applying the hack?
(¡Por supuesto! Ha habido varias versiones desde que hice este apaño. Puede que ya no funcione. ¿Podrías activar la depuración de PHP y enviar el registro de errores después de aplicar el apaño?)
There's been serveral versions from the one I made this hack. Perhap's it's no longer applicable. Could you please turn on PHP debugging in your site and post the error log after applying the hack?
(¡Por supuesto! Ha habido varias versiones desde que hice este apaño. Puede que ya no funcione. ¿Podrías activar la depuración de PHP y enviar el registro de errores después de aplicar el apaño?)
Please Log in or Create an account to join the conversation.
- Алексей
-
- Offline
- New Member
Less
More
- Posts: 2
12 years 3 months ago #74333
by Алексей
Replied by Алексей on topic Re: blog calendar doesn't pull from children categories
Dear forum users, in the modern version of the k2 such modification does not work.
I would be very grateful if you describe what I need to fix to this solution working in K2 v2.6.2
I would be very grateful if you describe what I need to fix to this solution working in K2 v2.6.2
Please Log in or Create an account to join the conversation.
- Helena
-
- Offline
- New Member
Less
More
- Posts: 1
12 years 2 months ago #74334
by Helena
Replied by Helena on topic Re: blog calendar doesn't pull from children categories
Hi Francisco José.
Finally I have adapt the code that you were raising in your post some time ago in order that my K2 calendar shows the children categories, but now I have a problem: when I click on the date in the calendar it jumps to a blank page. I am not a programmer and I don´t know what could be the reason, please could you (or someone) help me?
The code I have introduced in helper.php after replace itemlist.php is:
function getDateLink($day, $month, $year) {
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$aid = $user->get('aid');
$db = JFactory::getDBO();
$jnow = JFactory::getDate();
$now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql();
$nullDate = $db->getNullDate();
$languageCheck = '';
if (K2_JVERSION != '15')
{
$accessCheck = " access IN(".implode(',', $user->getAuthorisedViewLevels()).") ";
if ($mainframe->getLanguageFilter())
{
$languageTag = JFactory::getLanguage()->getTag();
$languageCheck = " AND language IN (".$db->Quote($languageTag).", ".$db->Quote('*').") ";
}
}
else
{
$accessCheck = " access <= {$aid}";
}
$query = "SELECT COUNT(*) FROM #__k2_items WHERE YEAR(created)={$year} AND MONTH(created)={$month} AND DAY (created)={$day} AND published=1 AND ( publish_up = ".$db->Quote($nullDate)." OR publish_up <= ".$db->Quote($now)." ) AND ( publish_down = ".$db->Quote($nullDate)." OR publish_down >= ".$db->Quote($now)." ) AND trash=0 AND {$accessCheck}
{$languageCheck} AND EXISTS(SELECT * FROM #__k2_categories WHERE id= #__k2_items.catid AND published=1 AND trash=0 AND
{$accessCheck} {$languageCheck})";
$catid = $this->category;
if ($catid > 0)
$categories = modK2ToolsHelper::getCategoryChildren($catid);
$categories[] = $catid;
$categories = @array_unique($categories);
$sql = @implode(',', $categories);
$query .= " AND catid IN ({$sql})";
$db->setQuery($query);
$result = $db->loadResult();
if ($db->getErrorNum())
{
echo $db->stderr();
return false;
}
if ($result > 0)
{
if ($catid > 0)
return JRoute::_(K2HelperRoute::getDateRoute($year, $month, $day, $catid));
else
return JRoute::_(K2HelperRoute::getDateRoute($year, $month, $day));
}
else
{
return false;
}
}
My K2 version is 2.6.5 and inks on dates are like this: .../joomla/index.php/component/k2/itemlist/date/2013/2/4?catid=115 and "catid" changes in consecutive numbers (115=February, 116 = March, etc ...)...
Thanks!
Helena
(Por fin he conseguido adaptar el código que planteabas en tu post de hace tiempo para que mi K2 calendar muestre las subcategorías, pero ahora tengo un problema y es que al pulsar sobre la fecha en el calendario me salta a una página en blanco. No soy programadora y no sé a qué se debe, ¿me puedes ayudar?
El código que he introducido en helper.php después de modificar el archivo itemlist.php es:
....
....
Mi versión de K2 es la 2.6.5 y el tipo de enlace que me sale en las fechas es: .../joomla/index.php/component/k2/itemlist/date/2013/2/4?catid=115 donde "catid" cambia por meses en números consecutivos (115=February, 116 = March, etc ...)...
Gracias!)
Finally I have adapt the code that you were raising in your post some time ago in order that my K2 calendar shows the children categories, but now I have a problem: when I click on the date in the calendar it jumps to a blank page. I am not a programmer and I don´t know what could be the reason, please could you (or someone) help me?
The code I have introduced in helper.php after replace itemlist.php is:
function getDateLink($day, $month, $year) {
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$aid = $user->get('aid');
$db = JFactory::getDBO();
$jnow = JFactory::getDate();
$now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql();
$nullDate = $db->getNullDate();
$languageCheck = '';
if (K2_JVERSION != '15')
{
$accessCheck = " access IN(".implode(',', $user->getAuthorisedViewLevels()).") ";
if ($mainframe->getLanguageFilter())
{
$languageTag = JFactory::getLanguage()->getTag();
$languageCheck = " AND language IN (".$db->Quote($languageTag).", ".$db->Quote('*').") ";
}
}
else
{
$accessCheck = " access <= {$aid}";
}
$query = "SELECT COUNT(*) FROM #__k2_items WHERE YEAR(created)={$year} AND MONTH(created)={$month} AND DAY (created)={$day} AND published=1 AND ( publish_up = ".$db->Quote($nullDate)." OR publish_up <= ".$db->Quote($now)." ) AND ( publish_down = ".$db->Quote($nullDate)." OR publish_down >= ".$db->Quote($now)." ) AND trash=0 AND {$accessCheck}
{$languageCheck} AND EXISTS(SELECT * FROM #__k2_categories WHERE id= #__k2_items.catid AND published=1 AND trash=0 AND
{$accessCheck} {$languageCheck})";
$catid = $this->category;
if ($catid > 0)
$categories = modK2ToolsHelper::getCategoryChildren($catid);
$categories[] = $catid;
$categories = @array_unique($categories);
$sql = @implode(',', $categories);
$query .= " AND catid IN ({$sql})";
$db->setQuery($query);
$result = $db->loadResult();
if ($db->getErrorNum())
{
echo $db->stderr();
return false;
}
if ($result > 0)
{
if ($catid > 0)
return JRoute::_(K2HelperRoute::getDateRoute($year, $month, $day, $catid));
else
return JRoute::_(K2HelperRoute::getDateRoute($year, $month, $day));
}
else
{
return false;
}
}
My K2 version is 2.6.5 and inks on dates are like this: .../joomla/index.php/component/k2/itemlist/date/2013/2/4?catid=115 and "catid" changes in consecutive numbers (115=February, 116 = March, etc ...)...
Thanks!
Helena
(Por fin he conseguido adaptar el código que planteabas en tu post de hace tiempo para que mi K2 calendar muestre las subcategorías, pero ahora tengo un problema y es que al pulsar sobre la fecha en el calendario me salta a una página en blanco. No soy programadora y no sé a qué se debe, ¿me puedes ayudar?
El código que he introducido en helper.php después de modificar el archivo itemlist.php es:
....
....
Mi versión de K2 es la 2.6.5 y el tipo de enlace que me sale en las fechas es: .../joomla/index.php/component/k2/itemlist/date/2013/2/4?catid=115 donde "catid" cambia por meses en números consecutivos (115=February, 116 = March, etc ...)...
Gracias!)
Please Log in or Create an account to join the conversation.
- Shapes
-
- Offline
- Junior Member
Less
More
- Posts: 30
11 years 8 months ago #74335
by Shapes
Replied by Shapes on topic Re: blog calendar doesn't pull from children categories
Hi there,
Has anyone got this fixed for newer version ? I'm using K2 v2.6.7, and got this done earlier on old version, but can't get to do it here.
Really thought K2 team would have added this fix since it's has been asked and fixed long time ago..
Hoping for answers,
Best regards,
David aka Shapes
Has anyone got this fixed for newer version ? I'm using K2 v2.6.7, and got this done earlier on old version, but can't get to do it here.
Really thought K2 team would have added this fix since it's has been asked and fixed long time ago..
Hoping for answers,
Best regards,
David aka Shapes
Please Log in or Create an account to join the conversation.