Suggestion - Calendar hook
#1
Posted 10 December 2011 - 02:32 AM
#2
Posted 14 December 2011 - 01:05 AM
Show forthcoming calendar events = Yes
Show forthcoming events from today to [x] days ahead = 30
ACP > IP.Calendar > "Name of your calendar"
Event Limit = 2
Doesn't that limit the displayed events for each day to only 2? That's still 60 entries if there is at least 2 per day, every single day for next month.
#3
Posted 04 January 2012 - 07:28 AM
#4
Posted 04 January 2012 - 07:53 PM
Pretty sure that's the code used to display the 'hook' block on the side of your forums.
You would need to change the "foreach loop" so it only loops 5 times. I don't know PHP to do this, so a search on forums should give you an idea or expert help.
For example you could put the contents between the "foreach" tags inside an IF statement that says something like
<ul class='ipsList_withminiphoto'>
<foreach loop="upcomingevents:$events as $event">
[b] <if 'eventscount' < '6'>[/b]
<li class='clearfix'>
<a href='{$event['url']}' title='{$event['date']}'>{$event['title']}</a>
<br /> <span class='date ipsType_small desc'>{$this->lang->words['next_occurrence']} {$event['date']}</span>
</li>
<'eventscount' = 'eventscounts'+'1'>
</foreach>
[b] </if>[/b]
</ul>
LOL that's obviously wrong code, but hopefully gives you an idea what I mean. It should only generate a calendar event and add to the block as long as the count is 0-5. When it gets to 6 it would exit the loop. That's the theory anyway, don't know the code to make it happen or even if you need to declare the 'eventscount' variable before the condition, etc
- svit likes this
#5
Posted 05 January 2012 - 01:10 AM
<if test="calendarEventsOuter:|:$events OR !$this->settings['autohide_calendar']">
<div class='ipsSideBlock clearfix'>
<h3>{$this->lang->words['upcoming_events']}</h3>
<div class='_sbcollapsable'>
<if test="calendarEventsInner:|:is_array( $events )">
<ul class='ipsList_withminiphoto'>
<foreach loop="upcomingevents:$events as $event">
<li class='clearfix'>
<a href='{$event['url']}' title='{$event['date']}'>{$event['title']}</a>
<br /> <span class='date ipsType_small desc'>{$this->lang->words['next_occurrence']} {$event['date']}</span>
</li>
</foreach>
</ul>
<else />
<span class='desc'>{$events}</span>
</if>
</div>
</div>
</if>and I wasn't able to identify where to change the count 0-5
#6
Posted 05 January 2012 - 01:14 AM
maybe? not solid on that at all tbh.Thank you, the code looks like this
<if test="calendarEventsOuter:|:$events OR !$this->settings['autohide_calendar']"> <div class='ipsSideBlock clearfix'> <h3>{$this->lang->words['upcoming_events']}</h3> <div class='_sbcollapsable'> <if test="calendarEventsInner:|:is_array( $events )"> <ul class='ipsList_withminiphoto'> <foreach loop="upcomingevents:$events as $e => $event"> <if test="$e<4"> <li class='clearfix'> <a href='{$event['url']}' title='{$event['date']}'>{$event['title']}</a> <br /> <span class='date ipsType_small desc'>{$this->lang->words['next_occurrence']} {$event['date']}</span> </li> </if> </foreach> </ul> <else /> <span class='desc'>{$events}</span> </if> </div> </div> </if>
and I wasn't able to identify where to change the count 0-5
#7
Posted 08 January 2012 - 12:44 PM
#8
Posted 08 January 2012 - 02:59 PM
then its not hitting the foreach loop there at all.... >.<Ah, marcher, that is the original hook without any change
<else />
<span class='desc'>{$events}</span>
</if>
#9
Posted 08 January 2012 - 03:15 PM
#10
Posted 08 January 2012 - 03:31 PM
line 337~
find:
foreach( $events as $event )
{
//-----------------------------------------
// Recurring?
//-----------------------------------------
$c_time = gmstrftime( '%x', $event['_start_time'] );
$url = $this->registry->output->buildSEOUrl( "app=calendar&module=calendar&section=view&do=showevent&event_id={$event['event_id']}", 'public', $event['event_title_seo'], 'cal_event' );
$show_events[] = array( 'url' => $url, 'date' => $c_time, 'title' => $event['event_title'] );
}
change it for:
$countme = 0;
foreach( $events as $event )
{
if($countme<=4)
{
//-----------------------------------------
// Recurring?
//-----------------------------------------
$c_time = gmstrftime( '%x', $event['_start_time'] );
$url = $this->registry->output->buildSEOUrl( "app=calendar&module=calendar&section=view&do=showevent&event_id={$event['event_id']}", 'public', $event['event_title_seo'], 'cal_event' );
$show_events[] = array( 'url' => $url, 'date' => $c_time, 'title' => $event['event_title'] );
$countme++;
}
}
tested and working.... the $e => $event wasnt flying, very likely because $e(array key) is either the cal_id or event_id.
- svit likes this
#11
Posted 09 January 2012 - 01:22 AM
#12
Posted 13 April 2012 - 12:54 AM
#13
Posted 13 April 2012 - 02:53 AM
<foreach loop="upcomingevents:$events as $event">Make it:
<if test="$this->_count=0"></if> <foreach loop="upcomingevents:$events as $event"> <if test="$this->_count++"></if> <if test="$this->_count<=5">Find:
</foreach>Make that:
</if> </foreach>?? stab in the dark it works locally.... course Im still not quite at all sure what triggers the else here in this template.
- svit likes this
#14
Posted 13 April 2012 - 06:49 AM
#15
Posted 13 April 2012 - 07:03 AM
Oh yes! You have saved my life, I owe you..
Many thanks!
could you give me a link/example how this hook looks like please?
#16
Posted 13 April 2012 - 07:20 AM
#17
Posted 13 April 2012 - 07:32 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













