Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: jamesgrant in November 25, 2004, 06:55:13 NACHMITTAGS

Titel: Changing the SSI Calendar Output
Beitrag von: jamesgrant in November 25, 2004, 06:55:13 NACHMITTAGS
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)
Titel: Re: Changing the SSI Calendar Output
Beitrag von: Grudge in November 25, 2004, 07:22:02 NACHMITTAGS
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
Titel: Re: Changing the SSI Calendar Output
Beitrag von: jamesgrant in November 26, 2004, 11:34:34 VORMITTAG
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)
Titel: Re: Changing the SSI Calendar Output
Beitrag von: Grudge in November 26, 2004, 11:42:06 VORMITTAG
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
Titel: Re: Changing the SSI Calendar Output
Beitrag von: jamesgrant in November 26, 2004, 06:04:02 NACHMITTAGS
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
Titel: Re: Changing the SSI Calendar Output
Beitrag von: [Unknown] in November 27, 2004, 02:48:54 VORMITTAG
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]
Titel: Re: Changing the SSI Calendar Output
Beitrag von: Grudge in November 27, 2004, 06:32:27 NACHMITTAGS
...and sorry for getting the ?> and } the wrnog way around... that's what you get for rushing :P
Titel: Re: Changing the SSI Calendar Output
Beitrag von: jamesgrant in November 28, 2004, 01:34:09 NACHMITTAGS
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! :(

Titel: Re: Changing the SSI Calendar Output
Beitrag von: [Unknown] in November 28, 2004, 07:57:38 NACHMITTAGS
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]
Titel: Re: Changing the SSI Calendar Output
Beitrag von: jamesgrant in November 29, 2004, 03:48:02 VORMITTAG
Wicked lol.... that works


Cheers for that [unknown]  ;D
Titel: Re: Changing the SSI Calendar Output
Beitrag von: Roger in Januar 09, 2005, 04:12:19 NACHMITTAGS
Is it possible to inclue de date in that list?  What would be the variable for that?

Thanks,
Roger
Titel: Re: Changing the SSI Calendar Output
Beitrag von: [Unknown] in Januar 11, 2005, 07:52:46 NACHMITTAGS
Zitat von: Roger in Januar 09, 2005, 04:12:19 NACHMITTAGS
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]
Titel: Re: Changing the SSI Calendar Output
Beitrag von: Roger in Januar 13, 2005, 12:52:58 VORMITTAG
Thanks for the clarification Unknown.

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

Cheers,
Roger
Titel: What if the calendar is empty?
Beitrag von: jamesgrant in Januar 23, 2005, 02:53:23 NACHMITTAGS
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??
Titel: Re: What if the calendar is empty?
Beitrag von: bcswebco.com in März 07, 2005, 11:58:10 VORMITTAG
Zitat von: jamesgrant in Januar 23, 2005, 02:53:23 NACHMITTAGS
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.
Titel: Re: Changing the SSI Calendar Output
Beitrag von: jamesgrant in März 13, 2005, 04:16:15 NACHMITTAGS
thanks  8) 8)
Titel: Re: Changing the SSI Calendar Output
Beitrag von: Gwion in März 23, 2006, 01:06:17 NACHMITTAGS
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?

Titel: Re: Changing the SSI Calendar Output
Beitrag von: mgjohns in April 06, 2006, 09:53:38 NACHMITTAGS
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"-->
Titel: Re: Changing the SSI Calendar Output
Beitrag von: lyngenielsen in September 10, 2007, 05:45:10 VORMITTAG
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
Titel: Re: Changing the SSI Calendar Output
Beitrag von: lyngenielsen in September 10, 2007, 03:55:35 NACHMITTAGS
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 (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 (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?
Titel: Re: Changing the SSI Calendar Output
Beitrag von: lyngenielsen in September 10, 2007, 04:01:33 NACHMITTAGS
By the way - the <?php ssi_todaysEvents(); ?> is also in action on the index.php page - please dont think this is correct output.
As u can see - its uses "comma (,)" and not the correct output as seen on http://www.isore.dk/forum/calendar_include.php (http://www.isore.dk/forum/calendar_include.php)
Titel: Re: Changing the SSI Calendar Output
Beitrag von: Fiery in Oktober 10, 2007, 01:47:09 VORMITTAG
Wow this was a really old topic that was dug up.  Many things have changed since that version of SMF.

It would be easier if one of you started a new topic, described exactly what you want to do, and told us your SMF version.

Thanks
Titel: Re: Changing the SSI Calendar Output
Beitrag von: myaicons in Januar 28, 2008, 10:05:38 NACHMITTAGS
i agree... lets go look for other topics in the forum dealing with SSI calendar or board outputs... do it.  better yet... maybe we can answer a few of them.