1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. To combat forum spam, new accounts will need to make at least one (valid) post.
    Otherwise, we will periodically purge all users without posts or that haven't confirmed their account.

minical and $showCat Issue...

Discussion in 'Mambo/Joomla Integration' started by metalshaper, Feb 16, 2011.

Thread Status:
Not open for further replies.
  1. metalshaper

    metalshaper not quite smart enough...

    Hey Gurus,

    I'm having another issue with two minicals on the same joomla page.

    Background:
    Ve9gra was awesome and got me sorted on my first issue that is in another post. Now I seem to have another issue. My $showCat are working but in a funny way.

    System:
    joomla 1.5.18 windows server
    PHP 5.2.9-1
    Single MySQL5 DB
    EPHPCAL 6.4.0 single install [need to update to 6.4.1 I know]
    mod_escal latest version. One mod for each calendar.

    1. mod_ephpcal for town events [town hall calendar]
    2. mod_ephpcal_events for local events [event calendar]
    I have two minicals on all pages.

    1. town hall calendar
    2. event calendar
    I have categories setup in the admin.
    [​IMG]

    For each calendar/module the filter results that I have added to $showCat.

    1. cal/mod townhall

    $CSS=1;
    $showCat="1|3|4";
    require ("calendar/calendar.php");
    $OL=1;
    require ("calendar/calendar.php");
    switch($jm_epccaltype)
    {
    case "mini":

    [​IMG]


    2. cal/mod event calendar

    $CSS=1;
    $showCat="a|2|6";
    require ("calendar/calendar.php");
    $OL=1;
    require ("calendar/calendar.php");

    switch($jm_epccaltype)
    {
    case "mini":

    [​IMG]

    So here's what is not working. Even with the $showCat set, the events calendar shows town hall events and NOT the categorized events for that calendar.

    check it here http://www.sharonct.org

    So, is there a solution? Am I not doing this correctly? Should I install a second calendar and reference that in the mod?

    TIA

    Joel
  2. Brian

    Brian EPC Developer Staff Member

    Can you make this work on the demo.php file (trying to eliminate Joomla as the issue)?
  3. metalshaper

    metalshaper not quite smart enough...

    Thank you Brian for the reply,

    I get the same behavior on the demo page when I add a second minical and apply filters to both. http://sharonct.org/calendar/demo.php

    The first instance seems to set the popup display to its' filter. Yet the second displays the correct legends for its' filter. Could be I need an "unset" somewhere but I don't know where.

    Joel
  4. Brian

    Brian EPC Developer Staff Member

    What happens if you reverse the order of the calendars?

    You might want to search the forum for unset and try the various suggestions. Off the top of my head right now, I don't remember what they are. (Note to self: Make a FAQ...)
  5. ve9gra

    ve9gra Support Team

    I see... it's the popups that aren't working like expected. And I can tell you why.

    When the require() for the small calendar gets called, that's when the JavaScript function popupEvent gets added to the page.

    This is the function for your first calendar:
    HTML:
    <script type="text/JavaScript">
    <!--
    function popupEvent(ev, w, h) {
      var winl = (screen.width - w) / 2;
      var wint = (screen.height - h) / 2;
      win = window.open("/calendar/functions/popup.php?ev=" + ev + "&showCat=1|3|4&oc=1","Calendar","scrollbars=yes,status=no,location=no,toolbar=no,menubar=no,directories=no,resizable=yes,width=" + w + ",height=" + h + ",top=" + wint + ",left=" + winl + "");
      if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
      }
    //-->
    </script>
    Then you get your second calendar on the page... and the second popupEvent
    HTML:
    <script type="text/JavaScript">
    <!--
    function popupEvent(ev, w, h) {
      var winl = (screen.width - w) / 2;
      var wint = (screen.height - h) / 2;
      win = window.open("/calendar/functions/popup.php?ev=" + ev + "&showCat=a|2|6&oc=1","Calendar","scrollbars=yes,status=no,location=no,toolbar=no,menubar=no,directories=no,resizable=yes,width=" + w + ",height=" + h + ",top=" + wint + ",left=" + winl + "");
      if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
      }
    //-->
    </script>
    Now, on the days that have events, they call the function like this
    HTML:
    onclick="popupEvent(2455614,250,220)"
    The first variable is the day to show in the popup, and the other two are for the size of the popup. Now, when you look in the function, you see that the $showCat has been added in there.

    What do you think happens when something on a page calls a function that has been declared twice?

    Yup... it takes the first one.

    So, your only fix is to not use on-click popups. However, Joomla doesn't play nice with mouse-over popups either as the variables required don't get declared properly.

    Rock, meet hard place. :)

    I would say your best bet is in trying to figure out how to fix Joomla so that the variables get called properly for the mouse-overs, because there's no fixing the other popups.

    Alternatively, you could run your calendars in small iframes...
  6. metalshaper

    metalshaper not quite smart enough...

    @Brian

    I tried that and the result is reversed. So 1st cal sets the function for the 2nd as well.

    @ Ve9gra

    I noticed the same thing as I was digging through the source.
    Now I have a clearer understanding of what's happening. Thank you for your explanation.

    So I will have to figure some other way to get this to work. iFrames may be the ticket. I will give that a try. If not, I may just link to a separate page altogether for the local events and not try to display a minical. If I do find a way to fix joomla mouseovers I will post my solution here for others.

    Still love the calendar though!

    Thanks Brian and Gervais for the help!
  7. ve9gra

    ve9gra Support Team

    The problem is with what I call "function variable isolation". Because Joomla uses a function to parse the PHP, stuff that you declare in the page isn't passed to the rest of the page because it gets segregated to the parsing function.

    One way that you can try is by adding
    PHP:
    require("calendar/config.inc.php");
    before the
    PHP:
    require("calendar/calendar.php");
    in each section. This might work, but only if Joomla didn't replace the require() function too.
Thread Status:
Not open for further replies.

Share This Page