Advertisement:

Author Topic: Changing the SSI Calendar Output  (Read 37373 times)

jamesgrant

  • Guest
Changing the SSI Calendar Output
« on: November 25, 2004, 06:55:13 PM »
hello...

I'm currently using the <!--#include virtual="./SSI.php?ssi_function=todaysEvents" --> in my shtml front page of my website to display the calendar...
I'm using it to display all the events coming up in the next 28 days.

It's a great feature, but when it's output onto my webpage, it's all in one long line. Ok, it's separated by commas, but i would love it to have 1 event to a line...

better still, could each event output be put into bullet points????

I was wondering if anyone knows of any way i can modify something to enable it to come out in a list, rather than a line????

 ::) ??? ::)

James


Edited by: A.M.A
How to do it: Please read (Reply #8)
« Last Edit: November 29, 2004, 04:25:19 PM by A.M.A »

Offline Grudge

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 10,742
  • Gender: Male
  • Unofficial nuisance
Re: Changing the SSI Calendar Output
« Reply #1 on: November 25, 2004, 07:22:02 PM »
Why not include it using PHP (Check ssi_examples.php), you can then return the results of the function as an array, and then process it yourself. You'll want to refer to the example file for how to include it as PHP, and then also check out the function in SSI.php to see how the array looks, to give you an idea something like this is an idea:
Code: [Select]
include('SSI.php');
$result = array();
todaysEvents($result);
echo '<ul>';
foreach ($result as $event)
echo '<li>' . $event['name'] . '</li>';
echo '</ul>';

Note that won't work as I haven't checked the function name and/or what is in the array but it's an idea, I'm sure someone else can help if needed - I'm off to bed
I'm only a half geek really...

jamesgrant

  • Guest
Re: Changing the SSI Calendar Output
« Reply #2 on: November 26, 2004, 11:34:34 AM »
Thanks for that grudge :)

i do understand that, but have no idea what variables or anything like that i need to use at all to get it work  ::)

So yeah, if anyone does know how to di it, that would be amazing lol

cheers

Jay  8)

Offline Grudge

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 10,742
  • Gender: Male
  • Unofficial nuisance
Re: Changing the SSI Calendar Output
« Reply #3 on: November 26, 2004, 11:42:06 AM »
What about this - should work I think:
Code: [Select]
<?php
include(&#39;SSI.php&#39;);
$result ssi_todaysEvents(&#39;array&#39;);
if (!empty($result))
{
echo &
#39;<ul>&#39;;
foreach ($result as $event)
echo &
#39;<li>&#39; . $event[&#39;link&#39;] . &#39;</li>&#39;;
echo &#39;</ul>&#39;;
?>

}

If it isn't in the same directory as your forum you may need include('forum/SSI.php') etc
I'm only a half geek really...

jamesgrant

  • Guest
Re: Changing the SSI Calendar Output
« Reply #4 on: November 26, 2004, 06:04:02 PM »
Thanks for that grudge...

I've tried it out though, and it doesnt seem to work  :( just has a blank space  :( :(

I've swapped the

}
?>

around though, cos that looks like it's round the wrong way???
Still doesnt work tho :(

The page i'm trying to use it in is a .shtml file... would that make any difference? i know you have little 'php' areas... but is it going to 'compile' right as it's .shtml? would it be handled differently by my server? or am i just talking about something i know nothing about really  ::)  :P

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Changing the SSI Calendar Output
« Reply #5 on: November 27, 2004, 02:48:54 AM »
Name this file "calendar_include.php" and put it in the forum's directory:

Code: [Select]
<?php

include(dirname(__FILE__) . &#39;/SSI.php&#39;);

$result ssi_todaysEvents(&#39;array&#39;);
if (!empty($result))
{
   echo &
#39;
      
<ul>&#39;;
   
foreach ($result as $event)
      echo &
#39;
         
<li>&#39;, $event[&#39;link&#39;], &#39;</li>&#39;;
   
echo &#39;
      
</ul>&#39;;
}

?>

Then, include it like so:

<!--#include virtual="./calendar_include.php" -->

Your whole site doesn't have to be PHP to use PHP ;).

-[Unknown]

Offline Grudge

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 10,742
  • Gender: Male
  • Unofficial nuisance
Re: Changing the SSI Calendar Output
« Reply #6 on: November 27, 2004, 06:32:27 PM »
...and sorry for getting the ?> and } the wrnog way around... that's what you get for rushing :P
I'm only a half geek really...

jamesgrant

  • Guest
Re: Changing the SSI Calendar Output
« Reply #7 on: November 28, 2004, 01:34:09 PM »
lol no worries grudge  ;)

Thanks for that too [unknown].... but that doesnt work either!!!

Bit closer to a result though: i have bullet points on the screen, but nothing else  >:( :'(

And i've checked, it isnt the font colour the same as the background colour or anything like that... it's just not there at all! :(

« Last Edit: November 28, 2004, 02:19:47 PM by jamesgrant »

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Changing the SSI Calendar Output
« Reply #8 on: November 28, 2004, 07:57:38 PM »
Name this file "calendar_include.php" and put it in the forum's directory:

Code: [Select]
<?php

include(dirname(__FILE__) . &#39;/SSI.php&#39;);

$result ssi_todaysEvents(&#39;array&#39;);
if (!empty($result))
{
   echo &
#39;
      
<ul>&#39;;
   
foreach ($result as $event)
      echo &
#39;
         
<li><a href="&#39; . $event[&#39;href&#39;] . &#39;">&#39; . $event[&#39;title&#39;] . &#39;</a></li>&#39;;
   
echo &#39;
      
</ul>&#39;;
}

?>

Then, include it like so:

<!--#include virtual="./calendar_include.php" -->

-[Unknown]

jamesgrant

  • Guest
Re: Changing the SSI Calendar Output
« Reply #9 on: November 29, 2004, 03:48:02 AM »
Wicked lol.... that works


Cheers for that [unknown]  ;D

Offline Roger

  • Jr. Member
  • **
  • Posts: 135
    • Kemp Interactive
Re: Changing the SSI Calendar Output
« Reply #10 on: January 09, 2005, 04:12:19 PM »
Is it possible to inclue de date in that list?  What would be the variable for that?

Thanks,
Roger

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Changing the SSI Calendar Output
« Reply #11 on: January 11, 2005, 07:52:46 PM »
Is it possible to inclue de date in that list?  What would be the variable for that?

Thanks,
Roger

I'm afraid there's no date available, but there probably should be.

-[Unknown]

Offline Roger

  • Jr. Member
  • **
  • Posts: 135
    • Kemp Interactive
Re: Changing the SSI Calendar Output
« Reply #12 on: January 13, 2005, 12:52:58 AM »
Thanks for the clarification Unknown.

Does this mean we might see a variable for that in a future version?

Cheers,
Roger

jamesgrant

  • Guest
What if the calendar is empty?
« Reply #13 on: January 23, 2005, 02:53:23 PM »
If there are no events to display within the set time frame (mine is currently set to display events within the next 30 days), the bit where my events would be is empty.

Is there any way to display a "there are currently no events available within the next 30 days" type thing bit of text if it doesnt pull any dates from the calendar??

Offline bcswebco.com

  • Semi-Newbie
  • *
  • Posts: 31
Re: What if the calendar is empty?
« Reply #14 on: March 07, 2005, 11:58:10 AM »
If there are no events to display within the set time frame (mine is currently set to display events within the next 30 days), the bit where my events would be is empty.

Is there any way to display a "there are currently no events available within the next 30 days" type thing bit of text if it doesnt pull any dates from the calendar??

Yes ... try this code for the calendar_include.php file.

It is the same as what was posted by [Unknown]  ... with an "else" statement added to cover if no events are scheduled.   

How many days the system looks ahead is determined in the layout settings of the board.

Code: [Select]
<?php

include(dirname(__FILE__) . &#39;/SSI.php&#39;);

$result ssi_todaysEvents(&#39;array&#39;);
if (!empty($result))
{
   echo &#39;
      <ul>&#39;;
   foreach ($result as $event)
      echo &#39;
         <li><a href="&#39; . $event[&#39;href&#39;] . &#39;">&#39; . $event[&#39;title&#39;] . &#39;</a></li>&#39;;
   echo &#39;
      </ul>&#39;;
}
else
      echo &#39;
         <br>There are currently no events<br><br>&#39;;

?>


Modify

Code: [Select]
<br>There are currently no events<br><br>
as needed for your site.

jamesgrant

  • Guest
Re: Changing the SSI Calendar Output
« Reply #15 on: March 13, 2005, 04:16:15 PM »
thanks  8) 8)

Offline Gwion

  • Semi-Newbie
  • *
  • Posts: 62
Re: Changing the SSI Calendar Output
« Reply #16 on: March 23, 2006, 01:06:17 PM »
I have tried what you say in this thread but unfortunately I couldn't get it to work.
When I call the SSI.php funciton it's fine, also when I call up calendar_include.php it shows the test entry I put in the calendar.
When I put this code <!--#include virtual= code in my html file it does not do anything.
The ssi_examples.shtml page however works fine.

I have not used SSI before but I assume my html file must be in the SMF directory? How must I change it (or what and where) so the html can stay in the top level directory?


Offline mgjohns

  • Newbie
  • *
  • Posts: 3
  • Gender: Male
Re: Changing the SSI Calendar Output
« Reply #17 on: April 06, 2006, 09:53:38 PM »
If your file extension is .html the "include" statement will not work.  Change the .html to .shtml and see if that works.  The location of the file itself is not that important.  Also, you need to ensure you have the path to the included file correct.

Some examples:
calendar.php is located in web_root/smf directory
myfile.shtml is located in web_root directory
Then you would need this:  <!--include virtual "smf/calendar.php"-->

calendar.php is located in web_root/smf directory
myfile.shtml is located in web_root/mydirectory directory
Then you would need this:  <!--include virtual "../smf/calendar.php"-->

Offline lyngenielsen

  • Jr. Member
  • **
  • Posts: 107
Re: Changing the SSI Calendar Output
« Reply #18 on: September 10, 2007, 05:45:10 AM »
Hi all ....

I had the same Q - and here You all have giving a nice solution.
But - is the an webpage where I can see the output of these different solution You have given here in this topic?

\Michael

Offline lyngenielsen

  • Jr. Member
  • **
  • Posts: 107
Re: Changing the SSI Calendar Output
« Reply #19 on: September 10, 2007, 03:55:35 PM »
Hi Guys ...

May I ask inhere?

I' va tryed to use the solutions you have given here, but have some failure.
(My coding is crap)  :-[


On this link: http://www.isore.dk/forum/calendar_include.php - the script works fine.

How come, when I use this
Code: [Select]
<!--#include virtual="../forum/calendar_include.php" --> on the first indexpage on this link: http://www.isore.dk/index.php - see under Kommende kalender "Events": (left bottom) - then it DOSNT work?

I use
Code: [Select]
<?php require("forum/SSI.php"); ?>   on each php page.

Can You help me?