TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,965
  • Latest: boruko
Stats
  • Total Posts: 195,980
  • Total Topics: 21,320
  • Online today: 281
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 231
  • Total: 231

How to display Birthdays without ","

Started by yjobcreations, March 08, 2007, 04:25:56 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

yjobcreations

i used this function:

ssi_todaysBirthdays();

it displays:

birthday1, birthday2, birthday3

i want it to display:

Birthday1
Birthday2
Birthday3


How?  :-\

technodragon73

edit the ssi code that determines birthdays. (not recommended though)

JPDeni

#2
The other thing you can do, especially if you want it in a block, is to copy the SSI code, paste it into a block and edit the code there.


global $context, $scripturl;

require_once ("SSI.php");

if (!smf_loadCalendarInfo() || empty($context['calendar_birthdays']))
  echo 'No birthdays today';
else {
  foreach ($context['calendar_birthdays'] as $member)
    echo '<a href="', $scripturl, '?action=profile;u=', $member['id'], '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>' . (!$member['is_last'] ? '<br />' : '');
}



yjobcreations

#5
JPDeni i there is one error in the code.

echo 'No birthdays today";

i replaced " with '

:)

----

by the way, how about the holidays and events?
i thought i would be nice to include them too and list in one line each like the birthdays.

thanks again.

JPDeni

Good job for noticing. I'll fix it in the original code. I also made another small change that might make a difference.

Do you want them all in the same block or separate ones? For the same block, use


global $context, $scripturl;

require_once ("SSI.php");

if (!smf_loadCalendarInfo() || empty($context['calendar_birthdays']))
  echo 'No birthdays today';
else {
  foreach ($context['calendar_birthdays'] as $member)
    echo '<a href="', $scripturl, '?action=profile;u=', $member['id'], '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>' . (!$member['is_last'] ? '<br />' : '');
}

if (!smf_loadCalendarInfo() || empty($context['calendar_holidays']))
  echo 'No holidays today';
else
  echo implode('<br />', $context['calendar_holidays']);

if (!smf_loadCalendarInfo() || empty($context['calendar_events']))
  echo 'No events';
else {
  foreach ($context['calendar_events'] as $event) {
    if ($event['can_edit'])
      echo '
        <a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ';
    echo '
      ' . $event['link'] . (!$event['is_last'] ? '<br />' : '');
  }
}


If you want three separate, use

Holidays:


global $context;
require_once ("SSI.php");
if (!smf_loadCalendarInfo() || empty($context['calendar_holidays']))
  echo 'No holidays today';
else
  echo implode('<br />', $context['calendar_holidays']);


Events:


global $context;
require_once ("SSI.php");
if (!smf_loadCalendarInfo() || empty($context['calendar_events']))
  echo 'No events';
else {
  foreach ($context['calendar_events'] as $event)  {
    if ($event['can_edit'])
      echo '
        <a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ';
    echo '
      ' . $event['link'] . (!$event['is_last'] ? '<br />' : '');
  }
}

yjobcreations

thanks.

i combined it with the Calendar block to display the names and events one line per entry.  the original code in the Calendar displays the entries continously separating them with commas.

This website is proudly hosted on Crocweb Cloud Website Hosting.