[EventCalendar] Big Calendar in a Category Template - How to do it?

Rick Boatright rboatright at gmail.com
Thu Mar 5 07:01:17 UTC 2009


Yes, the calls changed.
In 3.2, we are filtering "The Content" not the template to put the bigcal
in, so if you want  it on a CATAGORY ARCHIVE -- which frankly isn't
something we considered,  uh,  you can't use the [EC3BigCal} thing...
because that only works on PAGES not POSTS....

but you COULD call it directly.

The filter code that calls the big-calendar renderer is below, but
basically, you could do something along the lines of

      $calobj = new ec3_BigCalendar($options);
      $calcode = $calobj->generate();

      return $calcode;


here's the function that calls the ec3bigcalendar generator.


function ec3_filter_the_content_bigcal(&$post_content)
{
  if(is_page())
  {
    $placeholder = '[EC3BigCalendar';
    $pos=strpos($post_content,$placeholder);
    if($pos!==FALSE)
    {
      // Only load the Big Calendar code now that we know we need it.
      require_once(dirname(__FILE__).'/calendar-big.php');
      // Process options.
      $options=array();
      $options['id']='ec3_big_cal';
      $options['num_months']=1;
      $options['day_length']=9;
      $options['show_only_events']=1;
      $re='/\[EC3BigCalendar(:(\w+=\w+(&|&|&#0*38;))*(\w+=\w+))?]/i';
      if(preg_match($re,$post_content,$m))
      {
        if(!empty($m[1]))
        {
          $args = strtolower(preg_replace('/(&|&#0*38;)/','&',$m[1]));
          $options = wp_parse_args(substr($args,1),$options);
        }
        $placeholder = $m[0];
      }
      $calobj = new ec3_BigCalendar($options);
      $calcode = $calobj->generate();
      $post_content = str_replace($placeholder,$calcode,$post_content);
    }
  }
  return $post_content;




On Wed, Mar 4, 2009 at 11:39 PM, theplacebo webadmin <
theplacebo.webadmin at gmail.com> wrote:

> I've seen a few other people fumbling around with similar issues, but
> didn't see any solutions. (Er, at least any that I could *tell* were
> solutions.)
>
> I need to put the Big Calendar into the top of the custom Calendar
> category template I made, above the listing of posts in said category.
> (This in order to meet the request of the eventual site owners.) I'm
> having problems, no doubt because I am a n00b when it comes to mucking
> about in php templates and plug-ins.
>
> I tried using <?php echo do_shortcode('[EC3BigCalendar]'); ?> , but it
> merely prints out the short code, rather than implementing it. So the
> php I'm using to insert is that which I found here:
> http://wpcal.firetree.net/2008/10/26/big-calendar-version/
> i.e., |
> <div id="bigcalendar">
> <?php ec3_get_calendar("ec3default",1); ?>
> </div>|
>
> When I use it as-is, I get lots of errors, all looking more or less like:
> " Warning: array_key_exists() [function.array-key-exists]: The second
> argument should be either an array or an object in
> /[domain]/wp-content/plugins/event-calendar/calendar-sidebar.php on line
> 45 "
> though the line numbers change.
>
> The errors disappear if I delete the parameters from ec3_get_calendar(),
> but the Big Calendar itself looks just as wonky. Or rather, I should say
> the Small Calendar looks just as wonky, since that's what appears either
> way and just stretches itself across the page.
>
> ||So has the insert code perhaps it has changed with the latest beta
> version? Moving it about the template changes nothing and the template
> otherwise does what it should, displaying both the Calendar category and
> some HTML atop that.
>
> Wordpress version: 2.7.1
> Theme: modularity_lite
> EC3 version: 3.2.beta2.
>
> Test page using short code, looking fine:
> http://www.hummingtest.net/atl/calendar/
> Test category template using php, looking terrible:
> http://www.hummingtest.net/atl/category/calendar/
>
> Thanks very much, in advance
>
> _D. the (temporarily) Clueless
>
> ps. Thanks to Alex and the other coders for making EC3 available at all!
>
> _______________________________________________
> Blog: http://wpcal.firetree.net/
> EventCalendar at firetree.net mailing list
> Unsubscribe: http://penguin.firetree.net/eventcalendar
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://penguin.firetree.net/pipermail/eventcalendar/attachments/20090305/b276300e/attachment.html


More information about the EventCalendar mailing list