Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt November 11, 2024
svit Posted December 10, 2011 Posted December 10, 2011 After using the calendar hook for some time I would suggest it gives the admins option to choose how many upcoming events is to be shown in it. At present you can choose how many days it is monitoring and showing, this however has uncontrollable impact on the main page layout. If I set for example 30 days, it may be that there is no event in such case the block stays empty, but next day someone enters 15 events which completely breaks the mainpage layout, in such case I have to change the setting of the hook to say 10 days so I shrink it back. I we have set to have ti displaying 5 events I would know my main page looks as it should be.
Freeborne Posted December 14, 2011 Posted December 14, 2011 ACP > IP.Calendar > Calendar Settings 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.
svit Posted January 4, 2012 Author Posted January 4, 2012 Thanks Freeborne, but my issue was that I needed the hook to show only say 5 events of all that users submit i don's see how this advise would make this happen?
Freeborne Posted January 5, 2012 Posted January 5, 2012 ACP > Look & Feel > Edit your chosen skin(s) > Templates > Calendar > boardIndexCalEvents. 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"> <if 'eventscount' < '6'> <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> </if> </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 Posted January 5, 2012 Author Posted January 5, 2012 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 $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 :)
Marcher Technologies Posted January 5, 2012 Posted January 5, 2012 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 :smile: maybe? not solid on that at all tbh.
svit Posted January 8, 2012 Author Posted January 8, 2012 Ah, marcher, that is the original hook without any change :)
Marcher Technologies Posted January 8, 2012 Posted January 8, 2012 Ah, marcher, that is the original hook without any change :smile: then its not hitting the foreach loop there at all.... >.< <else /> <span class='desc'>{$events}</span> </if>
svit Posted January 8, 2012 Author Posted January 8, 2012 yest, that's why i have started the topics, as the hook is growing and growing, it seems i should rather contact the support team..
Marcher Technologies Posted January 8, 2012 Posted January 8, 2012 adminapplications_addonipscalendarsourceshooks.php 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 Posted January 9, 2012 Author Posted January 9, 2012 Wow, impressive :) it works, thank you so much, my pages look nice again :)
svit Posted April 13, 2012 Author Posted April 13, 2012 Hi Marcher for some reason this edit doesnt work in IPB 3.3.1 and my hooks are 1km long again.. would u have any idea how to fix it? I havent received help from the helpdesk stating they would have to change to code.
Marcher Technologies Posted April 13, 2012 Posted April 13, 2012 Find in {skin}->Calendar->boardIndexCalEvents: <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 Posted April 13, 2012 Author Posted April 13, 2012 Oh yes! You have saved my life, I owe you.. :) Many thanks!
ThomasS Posted April 13, 2012 Posted April 13, 2012 Oh yes! You have saved my life, I owe you.. :smile: Many thanks! could you give me a link/example how this hook looks like please?
svit Posted April 13, 2012 Author Posted April 13, 2012 http://www.cechoslovaci.com/ the recent event hook (topmost hook) - basically the code will cut the events list after the 5th event so it doesn't grow too big and doesn't spoil the board index page.
ThomasS Posted April 13, 2012 Posted April 13, 2012 ahh ok i see... so it's about the count vs. time range stuff... i thought it's also about a counter (like 5 upcoming events => "5" somewhere)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.