Kunena 7.0.4 Released

The Kunena team has announce the arrival of Kunena 7.0.4 [K 7.0.4] in stable which is now available for download as a native Joomla extension for J! 5.4.x/6.0.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 / K 6.4 and issues discovered during the last development stages of K 7.0

Question Rotating default_ex css file

More
15 years 11 months ago - 15 years 11 months ago #48233 by fireman
Hello,

Here is my issue:
I have a site for my fire department and we have 3 shifts (A, B and C, shifts), each working a 24 hour shift and off 48. The shifts are noted by color on our calendars. A-shift days are color coded black, B-shift color coded red and C-shift color coded green. I use a RT template and I have written a script that changes the color of the entire template based on the shift day.

I use the following as an included file:
Code:
<?php defined( '_JEXEC' ) or die( 'Restricted index access' ); /********************************* * PHP script for determining the * * shift date to get the color * * coded .css file. This script * * is for the sole use of the * * Indianapolis Fire Department * * under a license agreement with * * the department Information * * Technology Division. * * HIS retains the sole rights * * this script. * * Copyright 2009 * *********************************/ // get the gregorian date one variable at a time $themonth = date("m", time()); $theday = date("d", time()); $theyear = date("Y", time()); // get he hour element only $thehour = date("H", time()); // gregorian to julian date converter $jd = GregorianToJD($themonth,$theday,$theyear); // now remove a fraction to make the date accurate $jd = $jd - .5; // shift loader utilizing modulus to get correct $shiftday = $jd % 3; // copy day to time $shifttime = $shiftday; // simplify day if ($shifttime == 0){ if ($thehour < 07){ $shift = "a"; } elseif ($thehour == 07){ $shift = "atob"; } else { $shift = "b"; } } if ($shifttime == 1){ if ($thehour < 07){ $shift = "b"; } elseif ($thehour == 07){ $shift = "btoc"; } else { $shift = "c"; } } if ($shifttime == 2){ if ($thehour < 07){ $shift = "c"; } elseif ($thehour == 07){ $shift = "ctoa"; } else { $shift = "a"; } } // let's get shifty switch ($shift){ case a: $header_style = "black"; $body_style = "beige"; $bg_style = "bg-blue"; $footer_style = "black"; $primary_color = "grey"; break; case atob: $header_style = "black"; $body_style = "beige"; $bg_style = "bg-blue"; $footer_style = "black"; $primary_color = "orange"; break; case b: $header_style = "red"; $body_style = "beige"; $bg_style = "bg-blue"; $footer_style = "red"; $primary_color = "#A60000"; break; case btoc: $header_style = "red"; $body_style = "beige"; $bg_style = "bg-blue"; $footer_style = "red"; $primary_color = "red"; break; case c: $header_style = "green"; $body_style = "beige"; $bg_style = "bg-blue"; $footer_style = "green"; $primary_color = "green"; break; case ctoa: $header_style = "green"; $body_style = "beige"; $bg_style = "bg-blue"; $footer_style = "green"; $primary_color = "green"; break; default: $header_style = "blue"; $body_style = "beige"; $bg_style = "bg-blue"; $footer_style = "blue"; $primary_color = "blue"; break; } ?>

It works flawlessly and I has been happy for a year with it

Now I and integrated Kunena and I want the stylesheet for the forums to match the rest of the site. I can change the actuall css myself, but I am having difficulty getting the script to load anything but the default kunena.forum.css

Here is the include for the forum:
Code:
<?php defined( '_JEXEC' ) or die( 'Restricted index access' ); /********************************* * PHP script for determining the * * shift date to get the color * * coded .css file. This script * * is for the sole use of the * * Indianapolis Fire Department * * under a license agreement with * * the department Information * * Technology Division. * * HIS retains the sole rights * * this script. * * Copyright 2009 * *********************************/ // get the gregorian date one variable at a time $themonth = date("m", time()); $theday = date("d", time()); $theyear = date("Y", time()); // get he hour element only $thehour = date("H", time()); // gregorian to julian date converter $jd = GregorianToJD($themonth,$theday,$theyear); // now remove a fraction to make the date accurate $jd = $jd - .5; // shift loader utilizing modulus to get correct $shiftday = $jd % 3; // copy day to time $shifttime = $shiftday; // simplify day if ($shifttime == 0){ if ($thehour < 07){ $shift = "a"; } elseif ($thehour == 07){ $shift = "atob"; } else { $shift = "b"; } } if ($shifttime == 1){ if ($thehour < 07){ $shift = "b"; } elseif ($thehour == 07){ $shift = "btoc"; } else { $shift = "c"; } } if ($shifttime == 2){ if ($thehour < 07){ $shift = "c"; } elseif ($thehour == 07){ $shift = "ctoa"; } else { $shift = "a"; } } // let's get shifty switch ($shift){ case a: $shift_forum = "_a"; break; case atob: $shift_forum = "_a"; break; case b: $shift_forum = "_b"; break; case btoc: $shift_forum = "_b"; break; case c: $shift_forum = "_c"; break; case ctoa: $shift_forum = "_c"; break; default: $shift_forum = "u"; break; } ?>

Now I included this in the kunena.php file at line 167:
Code:
require_once (KUNENA_PATH .DS. "ifd_forumshiftloader_2.php");

and I changed this:
Code:
if ($fbConfig->joomlastyle < 1) { if (file_exists(KUNENA_JTEMPLATEPATH.'/css/kunena.forum.css')) { $document->addStyleSheet(KUNENA_JTEMPLATEURL . '/css/kunena.forum.css'); } else { $document->addStyleSheet(KUNENA_TMPLTCSSURL); } } else { $document->addStyleSheet(KUNENA_DIRECTURL . '/template/default/joomla.css'); }
to this
Code:
// Shift switcher changes begin here if ($fbConfig->joomlastyle < 1) { if (file_exists(KUNENA_JTEMPLATEPATH.'/css/kunena.forum'.$shift_forum.'.css')) { $document->addStyleSheet(KUNENA_JTEMPLATEURL . '/css/kunena.forum'.$shift_forum.'.css'); } else { $document->addStyleSheet(KUNENA_TMPLTCSSURL); } } else { $document->addStyleSheet(KUNENA_DIRECTURL . '/template/default/joomla.css'); } // Shift switcher changes end here
I changed the stylesheet for each day and named them kunena.forum.css_a, _b and _c, respectively and uploaded them to the default_ex folder.

The variable $shift_forum is supposed to append the url to add the _a, _b, or _c to the end of the kunena.forum.css like this kunena.forum_c.css, but it doesn't work. I still get the default css

I know the require_once file is including fine.
Any suggestions would be greatly appreciated.

Fireman
Last edit: 15 years 11 months ago by fireman.

Please Log in or Create an account to join the conversation.

More
15 years 11 months ago - 15 years 11 months ago #48234 by sozzled
G'day, fireman, and welcome to Kunena. :)

I think I understand the basic gist of what you have written - I'll leave the PHP coding aside, for the time being, to those who have a penchant for such things - but I wondered if we took a lateral approach to matters we might come up with an alternative that's simpler and just as effective.

You have to keep in the back of your mind what Kunena is used for: it's a discussion forum.

So, as long as we're clear on that point, I guess it's just a matter of your users being able to identify themselves with the categories of discussions that are relevant to them. If colour-coding those categories is a way to assist your users and given them a point of focus, so much the better.

So, what I was about to suggest is for you to look at a screenshot of the upcoming Kunena 1.6 version and tell us whether having colour-coded categories would assist you as an alternative to changing colour theme of the entire discussion board based on the day. My suggestion may not be suitable, but would you like to consider it? See Kunena 1.6 - "Cats" (not the musical)
Last edit: 15 years 11 months ago by sozzled.

Please Log in or Create an account to join the conversation.

More
15 years 11 months ago - 15 years 11 months ago #48235 by @quila
Hi Fireman,

what happens if you put the files "kunena.forum_a.css", "kunena.forum_b.css" and "kunena.forum_c.css" in the folder

{J!root} / templates / [your_joomla_template] / css /

Last edit: 15 years 11 months ago by @quila.

Please Log in or Create an account to join the conversation.

More
15 years 11 months ago - 15 years 11 months ago #48236 by fireman
You mean in the RT theme template css folder? If I did that, how would I change the kunena.php file to redirect the css to that folder.
Last edit: 15 years 11 months ago by fireman.

Please Log in or Create an account to join the conversation.

More
15 years 11 months ago - 15 years 11 months ago #48237 by @quila
Hi,

have you tried?

Yes I mean in the RT theme template css folder. You don't need to change nothing else in the kunena.php.
Definition "KUNENA_JTEMPLATEURL" is refered to Joomla selected template.

If you put these files in the css folder of your joomla template your code should work.

Regards
Last edit: 15 years 11 months ago by @quila.

Please Log in or Create an account to join the conversation.

More
15 years 11 months ago #48238 by fireman
Looks like that may have done it!

Thanks

Please Log in or Create an account to join the conversation.

Time to create page: 0.279 seconds