TinyPortal

Development => Support => Topic started by: TeamKaas on January 23, 2009, 10:59:42 AM

Title: Calendar on frontpage
Post by: TeamKaas on January 23, 2009, 10:59:42 AM
Howdy boys!

How can I get the full display calendar on the frontpage? We already tried selecting 'Today's Calendar' as an SSI Function in Panels and Blocks, but with this we only got 'Upcoming Events', instead of the full 'month view' calendar.

Regards, Team Kaas.
Title: Re: Calendar on frontpage
Post by: Zetan on January 23, 2009, 01:08:39 PM
Welcome to TP.

Have a look in the Block Code Snippets board: http://www.tinyportal.net/index.php/board,46.0.html

There are a few in there, you can see an example on my site: www.slayingsteel.com
Features: Birthdays, Events, Holidays and Month view. look ahead is set in the general site Calender options.

I have removed all but Events from mine.


Z
Title: Re: Calendar on frontpage
Post by: TeamKaas on January 23, 2009, 02:48:01 PM
Those are nice, but not completely what we are looking for ;) .

We want the frontpage to look like the calendar page, with the big calendar on it :) .
This is what we have atm (don't mind the crappy lay out, that is 'work in progress' ) :
http://project.cmd.hro.nl/2008_2009/klas_cmd1a_team5/communitycmd1a/

We want the 'Home' page to look like the 'Calendar' page :) . We might just make the calendar page the front page, but that isn't a very nice solution :) .
Title: Re: Calendar on frontpage
Post by: JPDeni on January 23, 2009, 03:00:30 PM
Maybe you could make an html article and use an iframe. I've never tried it, but you could give it a shot.
Title: Re: Calendar on frontpage
Post by: TeamKaas on January 23, 2009, 03:05:15 PM
Yes we tried that, unfortunately it didn't work properly (i don't know the details, a teammate tried that). I will ask him what was wrong with that :) .
Title: Re: Calendar on frontpage
Post by: JPDeni on January 23, 2009, 03:10:36 PM
Okay. Well, here's another thought.

Create a php article. In it put:


require_once("Calendar.php");
CalendarMain();


I don't know if that will work either, but that's what SMF uses to print out the calendar, so it might.
Title: Re: Calendar on frontpage
Post by: TeamKaas on January 23, 2009, 04:54:39 PM
Yes we tried doing it with an iframe, but we couldn't extract the calendar part from the page. So instead of only the calendar, we got al the navigation etc. as well.

I tried your code,but it produces the following error:
Fatal error: Cannot redeclare template_main() (previously declared in xxx/Sources/Load.php(1735) : eval()'d code:8) in xxx/Sources/Load.php(1735) : eval()'d code on line 162
Title: Re: Calendar on frontpage
Post by: JPDeni on January 23, 2009, 04:57:55 PM
I was afraid of that.

It looks like you're going to have to manually copy the code, then. Or... Maybe you could do a redirect within your server. When anybody comes to the main page, they get redirected to the calendar.

I have a natural aversion to duplication of code. It sort of makes my skin crawl, so I'm having a really hard time with this whole concept. :)
Title: Re: Calendar on frontpage
Post by: JPDeni on January 23, 2009, 05:42:25 PM
I got it to do what I think you want to do -- see my test site at http://jpdeni.comze.com/

Here's how to do it:

Open Sources/Calendar.php

Copy the function CalendarMain(), but don't include the first lines


function CalendarMain()
{


or the last }

Paste the function into a text editor.

In the first line, add the $settings variable to the globals, so it looks like this:


global $txt, $context, $modSettings, $scripturl, $options, $settings;


Remove the lines


// This is gonna be needed...
loadTemplate('Calendar');


and, in their place, put


require_once('Calendar.php');


Delete


// Permissions, permissions, permissions.
isAllowedTo('calendar_view');

// You can't do anything if the calendar is off.
if (empty($modSettings['cal_enabled']))
fatal_lang_error('calendar_off', false);

// Set the page title to mention the calendar ;).
$context['page_title'] = $context['forum_name'] . ': ' . $txt['calendar24'];


Open your theme's Calendar.template.php file. If you don't have that file in your theme directory, use the one in the default theme directory. Copy the function template_main starting with


echo '
<div style="padding: 3px;">', theme_linktree(), '</div>


(That is, do not include the "function" lines or the "global" line.)

Also, do not include the closing } at the end of the function. Be careful not to include any other functions in what you're copying. It's easy to do.

Paste the code from the template file into your text editor after the code you already pasted there.

Put it into a php article and set all of your stuff. You probably won't want to have the linktree as one of your article options because there's a linktree in the calendar.

Once you get it to working, play around with the display however you want. :)
Title: Re: Calendar on frontpage
Post by: JPDeni on January 23, 2009, 06:17:58 PM
I looked at your site and I didn't see the TinyPortal copyright information there. If you don't have TP installed, then nothing we have said here will help you. If you do have it installed, you need to put the copyright information back.
Title: Re: Calendar on frontpage
Post by: TeamKaas on January 23, 2009, 06:59:00 PM
I guess that was deleted when we modified the theme. We will try to get it back on ;) .
Title: Re: Calendar on frontpage
Post by: TeamKaas on January 26, 2009, 10:18:31 PM
Update: your code worked! Thanks for all the help.

Also, the footer is redesigned (including the copyright notice :) )
Title: Re: Calendar on frontpage
Post by: JPDeni on January 26, 2009, 10:20:09 PM
Cool!  :up:  8)
Title: Re: Calendar on frontpage
Post by: IchBin on January 27, 2009, 03:49:06 AM
As usual, JPDeni pulls through! :up:
Title: Re: Calendar on frontpage
Post by: JPDeni on January 27, 2009, 04:14:12 AM
:) Thanks, Ich.
Title: Re: Calendar on frontpage
Post by: Ken. on January 27, 2009, 01:37:38 PM
Quote from: IchBinâ„¢ on January 27, 2009, 03:49:06 AM
As usual, JPDeni pulls through! :up:

:up: