Keyword

Calendar class loads in Tools even if not needed

More
11 years 11 months ago #104749 by Yorb
Hello,

This is not a bug exactly but let me know if you'd like me to file it in the tracker.

I'm using K2 for some parts of a larger website, and consequently I have K2 modules on some Joomla! core content pages and vice versa. I'm using the K2 Tools module in many places in "Custom Code" mode, to avoid having to install a dedicated custom code module. It works quite well, except that it seems to load classes for other functions of the K2 Tools module even if they're not needed. First of all, this is unnecessary. More importantly, however, it leads to this error on some pages:

Fatal error: Cannot redeclare class Calendar [...]


This is appearing on a Joomla! core article display with a K2 Tools module on it in Custom Code mode, and it's appearing because I'm using a different extension (called Blog Calendar Reload) which also happens to use the Calendar class that K2 uses. I have several workaround options, but perhaps K2 should only load the Calendar class on pages that have a K2 Tools module in Blog-style Calendar mode. Alternatively, rename the calendar class K2Calendar, or check to see if it's defined before loading it. Or even better, do all 3! :)

Thanks for the continued support on a great extension.

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


Powered by Kunena Forum