collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 289
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

NEED HELP? If you're looking for support with Simple Portal, look no further than the Support Board!

Author Topic: Title of subject near the events of calendar blog ?  (Read 11077 times)

0 Members and 1 Guest are viewing this topic.

Offline Alpay

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Title of subject near the events of calendar blog ?
« on: March 11, 2016, 08:49:00 AM »
Hello,

How can we put the events of calendar blog near title of subject ?
(Settings : Default board to post events in)

PortalBlocks.php :

Code: [Select]
foreach ($day['events'] as $event)
echo '
<li class="sp_list_indent">', sp_embed_image('event'), ' ', $event['link'], '  </li>';
}

Offline emanuele

  • Developer
  • *
  • Posts: 293
Re: Title of subject near the events of calendar blog ?
« Reply #1 on: March 11, 2016, 02:41:33 PM »
Which one is it the "title of subject"? (Sorry, I'm not familiar with that particular block.)

Offline Alpay

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Title of subject near the events of calendar blog ?
« Reply #2 on: March 12, 2016, 11:44:49 AM »
Attach :)

Offline emanuele

  • Developer
  • *
  • Posts: 293
Re: Title of subject near the events of calendar blog ?
« Reply #3 on: March 14, 2016, 10:27:09 AM »
Not tested at all.
Code: (find) [Select]
$calendar_data = getCalendarGrid($curPage['month'], $curPage['year'], $calendarOptions);
Code: (add after) [Select]
$events = array();
foreach ($calendar_data['weeks'] as $week)
{
foreach ($week['days'] as $day)
{
if (!empty($day['events']))
{
$events[] = $day['id'];
}
}
}

$topics = array();
if (!empty($events))
{
$request = $smcFunc['db_query']('', '
SELECT c.id_event, t.id_topic, m.subject
FROM {db_prefix}calendar AS c
LEFT JOIN {db_prefix}topics AS t ON (c.id_topic = t.id_topic)
LEFT JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
WHERE c.id_event IN ({array_int:events})
LIMIT {int:num_events}',
array(
'events' => $events,
'num_events' => count($events),
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$topics[$row['id_event']] = $row;
}
}

Code: (find) [Select]
foreach ($day['events'] as $event)
echo '
<li class="sp_list_indent">', sp_embed_image('event'), ' ', $event['link'], '  </li>';

Code: (replace with) [Select]
foreach ($day['events'] as $event)
echo '
<li class="sp_list_indent">',
sp_embed_image('event'), ' ', $event['link'],
isset($topics[$event['id']]) ? ' | <a href="' . $scripturl . '?topic=' . $topics[$event['id']]['id_topic'] . '.0">' . $topics[$event['id']]['subject'] . '</a>' : '',
'</li>';

Offline Alpay

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Title of subject near the events of calendar blog ?
« Reply #4 on: March 15, 2016, 05:09:51 AM »
Thank you so much for your help.

   But it does not seem :(

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: Title of subject near the events of calendar blog ?
« Reply #5 on: March 15, 2016, 05:43:49 AM »
"It doesn't work" is not an explanation and is not helpful, if you try to explain what happens and what exactly doesn't work then he may be able to fix it ;)

Regards
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline emanuele

  • Developer
  • *
  • Posts: 293
Re: Title of subject near the events of calendar blog ?
« Reply #6 on: March 15, 2016, 08:40:07 AM »
   But it does not seem :(
hmm...
I see at least three possibilities:
1) it gives a syntax error,
2) it give another error,
3) it doesn't show anything despite not giving errors,
4) it shows something but not what you want,
5) it shows what you want, but not the way you want it.
...actually I arrived at 5 possibilities. :P
As I said, I didn't try it (mainly because I don't have at the moment a spare reliable SP install anywhere, most of those I have are either development or modified for some reason), so I have no idea of what it does, some more details would help. ;)

Offline Alpay

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Title of subject near the events of calendar blog ?
« Reply #7 on: March 16, 2016, 07:32:15 AM »
yep :)

3) it doesn't show anything despite not giving errors,

will you be avaible soon? is there a chance you try it?

Offline emanuele

  • Developer
  • *
  • Posts: 293
Re: Title of subject near the events of calendar blog ?
« Reply #8 on: March 22, 2016, 12:21:20 PM »
With a little change to the code above (that was broken, so I have no idea how it didn't give you an error), works as expected.
The correct code is:
Code: [Select]
$events = array();
foreach ($calendar_data['weeks'] as $week)
{
foreach ($week['days'] as $day)
{
if (!empty($day['events']))
{
foreach ($day['events'] as $ev)
{
$events[] = $ev['id'];
}
}
}
}

$topics = array();
global $smcFunc;
if (!empty($events))
{
$request = $smcFunc['db_query']('', '
SELECT c.id_event, t.id_topic, m.subject
FROM {db_prefix}calendar AS c
LEFT JOIN {db_prefix}topics AS t ON (c.id_topic = t.id_topic)
LEFT JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
WHERE c.id_event IN ({array_int:events})
LIMIT {int:num_events}',
array(
'events' => $events,
'num_events' => count($events),
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$topics[$row['id_event']] = $row;
}
}

Offline Alpay

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Title of subject near the events of calendar blog ?
« Reply #9 on: March 23, 2016, 01:37:42 PM »
thank you for help me :)

but; testing:
3) it doesn't show anything despite not giving errors,

Offline emanuele

  • Developer
  • *
  • Posts: 293
Re: Title of subject near the events of calendar blog ?
« Reply #10 on: March 24, 2016, 06:29:16 AM »
Do you have any link I can see it in action?
I wonder if you have clicked on the day you have any event, because AFAIK the text is shown only either on the of an event, or when you click on a day that has an event.

Offline Alpay

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Title of subject near the events of calendar blog ?
« Reply #11 on: March 26, 2016, 04:17:04 PM »
Unfortunately its only work on local. :(
Sending screen shots with attach;


Offline emanuele

  • Developer
  • *
  • Posts: 293
Re: Title of subject near the events of calendar blog ?
« Reply #12 on: March 27, 2016, 09:16:08 AM »
Well, if it works on your localhost it shall work on your online version as well provided that:
1) you are changing the correct file,
2) you are using the same block.

It may not be the case, but if you are using php 5.5+, the php opcache could cause delays in "taking up" the new version of the file (in certain cases they may be completely missed).

Offline Alpay

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Title of subject near the events of calendar blog ?
« Reply #13 on: March 27, 2016, 11:33:43 AM »
portalblocks.php

find :

Code: [Select]
foreach ($calendar_data['weeks'] as $week)
{
foreach ($week['days'] as $day)

before:

Code: [Select]
$events = array();
foreach ($calendar_data['weeks'] as $week)
{
foreach ($week['days'] as $day)
{
if (!empty($day['events']))
{
foreach ($day['events'] as $ev)
{
$events[] = $ev['id'];
}
}
}
}

$topics = array();
global $smcFunc;
if (!empty($events))
{
$request = $smcFunc['db_query']('', '
SELECT c.id_event, t.id_topic, m.subject
FROM {db_prefix}calendar AS c
LEFT JOIN {db_prefix}topics AS t ON (c.id_topic = t.id_topic)
LEFT JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
WHERE c.id_event IN ({array_int:events})
LIMIT {int:num_events}',
array(
'events' => $events,
'num_events' => count($events),
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$topics[$row['id_event']] = $row;
}
}

it works ^^
thank you very much @emanuele