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,973
  • Latest: NonStop
Stats
  • Total Posts: 196,236
  • Total Topics: 21,353
  • Online today: 739
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 520
  • Total: 521
  • lurkalot

Calendar on frontpage

Started by TeamKaas, January 23, 2009, 10:59:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TeamKaas

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.

Zetan

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

TeamKaas

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

JPDeni

Maybe you could make an html article and use an iframe. I've never tried it, but you could give it a shot.

TeamKaas

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

JPDeni

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.

TeamKaas

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

JPDeni

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

JPDeni

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

JPDeni

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.

This website is proudly hosted on Crocweb Cloud Website Hosting.