Welcome to Geeklog, Anonymous Saturday, June 22 2024 @ 06:15 am EDT

Geeklog Forums

Calendar next events on front page

Status: offline


Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France

In lib-custom.php add this function:

Text Formatted Code

function phpblock_listevents( $displaymode='display' )

        global $_TABLES, $LANG01, $LANG02, $LANG22, $_CONF, $LANG_ACCESS;

    $retval = '';

    $event_templates = new Template($_CONF['path_system'] . 'custom/event');

        $event_templates->set_var('site_url', $_CONF['site_url']);

        $result = DB_query("SELECT * FROM {$_TABLES['events']} WHERE TO_DAYS(dateend) >= TO_DAYS(NOW()) ORDER BY datestart, timestart");

        $nrows = DB_numRows($result);
        if ($nrows > 0) {
        for ($i = 0;$i < $nrows; $i++) {
        $A = DB_fetchArray($result);
        $access = SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']);
        if ($access > 0) {
            $thesdatetime = strftime( '%A %d %B %Y', strtotime($A['datestart'].' '.$A['timestart']) );
            $event_templates->set_var('event_id', $A['eid']);
            $event_templates->set_var('event_title', $A['title']);
            $event_templates->set_var('event_access', $access);

            $theedatetime = strftime( '%A %d %B %Y', strtotime($A['dateend'].' '.$A['timeend']) );
                        if( $A['datestart'] == $A['dateend'] )
                                {$event_templates->set_var('event_cal', $thesdatetime);}
                                {$event_templates->set_var('event_cal', $thesdatetime);}                                       
            $event_templates->parse('event_row', 'row', true);
    $event_templates->parse('output', 'list');

        } else if ($nrows < 1) {
        $retval .= "No next event.";
    $retval .= $event_templates->finish($event_templates->get_var('output'));

    return $retval;


Create a custom folder in the system folder. Create a event folder in the custom folder and add these two files:


Text Formatted Code

                            <!-- eventlist.thtml -->
                                                        <table border="0" cellspacing="0" cellpadding=3 width="100%">
                                    <th align="left">Calendar</th>
                                                                        <th width="60%" align="left"></th>
                                                        <p><br/>You can <a href="{site_url}/submit.php?type=calendar">add an event</a> in this calendar or <a href="{site_url}/calendar/index.php">see the calendar</a>.</p>


Text Formatted Code

<!-- listitem.thtml -->
                                <tr align="center">
                                    <td align="left" valign="top" style="border-bottom:1px solid #EEE; padding-left:5px;">{event_cal}</td>
                                    <td align="left" valign="top" style="border-bottom:1px solid #EEE;padding-left:5px;">
                                        <a href="{site_url}/calendar/event.php?eid={event_id}">{event_title}</a>

Then in a php static page center block on front page:

Text Formatted Code

echo phpblock_listevents(display);

I'm available to customise your themes or plugins for your Geeklog CMS

All times are EDT. The time is now 06:15 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content