Changing the SSI Calendar Output

Started by jamesgrant, November 25, 2004, 06:55:13 PM

Previous topic - Next topic

jamesgrant

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)

Grudge

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:

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

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)

Grudge

What about this - should work I think:

<?php
include('SSI.php');
$result ssi_todaysEvents('array');
if (!empty(
$result))
{
echo 
'<ul>';
foreach (
$result as $event)
echo 
'<li>' $event['link'] . '</li>';
echo 
'</ul>';
?>

}


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

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

[Unknown]

Name this file "calendar_include.php" and put it in the forum's directory:

<?php

include(dirname(__FILE__) . '/SSI.php');

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

?>


Then, include it like so:

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

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

-[Unknown]

Grudge

...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

#7
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! :(


[Unknown]

Name this file "calendar_include.php" and put it in the forum's directory:

<?php

include(dirname(__FILE__) . '/SSI.php');

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

?>


Then, include it like so:

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

-[Unknown]

jamesgrant

Wicked lol.... that works


Cheers for that [unknown]  ;D

Roger

Is it possible to inclue de date in that list?  What would be the variable for that?

Thanks,
Roger

[Unknown]

Quote from: Roger 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

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

-[Unknown]

Roger

Thanks for the clarification Unknown.

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

Cheers,
Roger

jamesgrant

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??

bcswebco.com

Quote from: jamesgrant 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??

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.

<?php

include(dirname(__FILE__) . '/SSI.php');

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

?>



Modify

<br>There are currently no events<br><br>

as needed for your site.


Gwion

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?


mgjohns

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"-->

lyngenielsen

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

lyngenielsen

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 <!--#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 <?php require("forum/SSI.php"); ?>   on each php page.

Can You help me?

Advertisement: