• [MOD] Kalender / Calendar (by Cr@zy Sash) 4 0 5 1
Currently:  

Author Topic: [MOD] Kalender / Calendar (by Cr@zy Sash)  (Read 80352 times)

0 Members and 1 Guest are viewing this topic.

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
[MOD] Kalender / Calendar (by Cr@zy Sash)
« on: April 18, 2005, 07:04:37 PM »
Originally posted/Author: Cr@zy Sash

Eigentlich mehr ne Spielerei als ein Mod. *gg* ;)
Well not really a mod. *gg*  ;)


Übersicht: / Overview:


Mit diesem Mod kannst du den aktuellen Monat als Kalender anzeigen lassen. /
You may show the actual month as a calendar with this mod

Geänderte Dateien: / Changed files:


- includes/page_header.php
- lang/<deine Sprache>/main.php
- templates/<dein Template>/style.css

Neue Dateien: / New files:


- templates/<dein Template>/calendar.html

Installation

WICHTIG: Mache vorher von diesen Dateien ein Backup
IMPORTANT: Before implementing this mod - back-up your files

1.)
Öffne die Datei includes/page_header.php und füge folgenen Code ein: /
Open includes/page_header.php and add this code:

Code: [Select]
//-----------------------------------------------------
//--- Calendar ----------------------------------------
//-----------------------------------------------------
$dat = time();
$dat0 = getdate($dat);
$datj=$dat0[month]." ".$dat0[year];
if($calshow==""){$calshow=$dat0[month]." ".$dat0[year];}
$dath=$calshow;
$calshow="";
$dat5="1 ".$dath;
$dat1 = getdate(strtotime($dat5));
$dat2 = getdate(strtotime($dat5." -1 month"));
$datr=$dat2[month]." ".$dat2[year];
$dat3 = getdate(strtotime($dat5." +1 month"));
$datv=$dat3[month]." ".$dat3[year];
$erster=$dat1[wday];

if($erster!=1){
  if($erster==0){$erster=7;}
  $calendar_data = "<tr>";
  for($i=0;$i<$erster-1;$i++){$calendar_data .= "<td class=\"smalltext\">&nbsp;</td>";}
  }
for($i=1;$i<=31;$i++){
  $dat4 = getdate(strtotime($i." ".$dath));
  $heute=$dat4[wday];
  if($heute==0){$heute=7;}
  if($dat1[mon]==$dat4[mon]){
    $stil="calat";
    $dum1=$dat0[mday].".".$dat0[mon].".".$dat0[year];
    $dum2=$dat4[mday].".".$dat4[mon].".".$dat4[year];
    if($dum1==$dum2){
      if(($heute==6) || ($heute==7)){$stil="calht";}else{$stil="calht";}
      }
      else{
      if(($heute==6) || ($heute==7)){$stil="calwe";}else{$stil="smalltext";}
      }
    if ($i<=9){$k="0";}else{$k="";}
    if($heute==1){$calendar_data .= "<tr>";}
    $calendar_data .= "<td align=\"center\" class=\"".$stil."\">".$k.$i."</td>";
    if($heute==7){$calendar_data .= "</tr>";}
    $j=$heute;
    }
  }
if ($j!=7){
  for ($i=0;$i<7-$j;$i++){$calendar_data .= "<td class=\"smalltext\"></td>";}
  $calendar_data .= "</tr>";
  }
$calendar_data .= "</table></td></tr></table></td></tr></table>";

1.a) for 4images 1.7 add this code below:
Code: [Select]
$calendar = $site_template->parse_template("calendar");
$site_template->register_vars(array(
    "calendar" => $calendar,
    "calendar_data" => $calendar_data,
    "lang_calendar" => $lang['lang_calendar'],
    "lang_mo" => $lang['lang_mo'],
    "lang_di" => $lang['lang_di'],
    "lang_mi" => $lang['lang_mi'],
    "lang_do" => $lang['lang_do'],
    "lang_fr" => $lang['lang_fr'],
    "lang_sa" => $lang['lang_sa'],
    "lang_so" => $lang['lang_so']
  ));
  unset($calendar);

1.b) for 4images 1.7.1 add this code below:
Code: [Select]
$site_template->register_vars(array(
   "calendar_data" => $calendar_data,
   "lang_calendar" => $lang['lang_calendar'],
   "lang_mo" => $lang['lang_mo'],
   "lang_di" => $lang['lang_di'],
   "lang_mi" => $lang['lang_mi'],
   "lang_do" => $lang['lang_do'],
   "lang_fr" => $lang['lang_fr'],
   "lang_sa" => $lang['lang_sa'],
   "lang_so" => $lang['lang_so']
 ));
$site_template->register_vars("calendar", $site_template->parse_template("calendar"));


2.)
Öffne die lang/<deine Sprache>/main.php und füge folgendes ein: /
Open lang/<yourlanguage>/main.php and add this code:
     2a) Deutsch
Code: [Select]
//-----------------------------------------------------
//--- Calendar ---------------------------------------
//-----------------------------------------------------
$lang['lang_calendar'] = "Kalender";
$lang['lang_mo'] = "Mo";
$lang['lang_di'] = "Di";
$lang['lang_mi'] = "Mi";
$lang['lang_do'] = "Do";
$lang['lang_fr'] = "Fr";
$lang['lang_sa'] = "Sa";
$lang['lang_so'] = "So";
     2b) English
Code: [Select]
//-----------------------------------------------------
//--- Calendar ---------------------------------------
//-----------------------------------------------------
$lang['lang_calendar'] = "Calendar";
$lang['lang_mo'] = "Mo";
$lang['lang_di'] = "Tu";
$lang['lang_mi'] = "We";
$lang['lang_do'] = "Th";
$lang['lang_fr'] = "Fr";
$lang['lang_sa'] = "Sa";
$lang['lang_so'] = "Su";

3.)
Öffne templates/<dein Template>/style.css und füge das ein:
Open templates/<yourtemplate>/style.css and add the following:

Code: [Select]
.calht {
  color: Black;
  background-color:#FFCC00;
  font-family: verdana,arial,helvetica,sans-serif;
  font-size: xx-small;
  font-weight: bold;
}

.calwe {
  color: Red;
  font-family: verdana,arial,helvetica,sans-serif;
  font-size: xx-small;
}

4.)
Erstelle eine neue Datei templates/<dein Template>/calendar.html
Create a new file templates/<yourtemplate>/calendar.html

Code: [Select]
<table width="100%" border="0" cellspacing="0" cellpadding="1">
  <tr>
    <td class="head1">
      <table width="130" border="0" cellspacing="0" cellpadding="3">
        <tr>
          <td valign="top" class="head1">{lang_calendar}</td>
        </tr>
        <tr>
          <td valign="top" class="row2">
            <table border="0" cellpadding="0" cellspacing="0" width="100%">
              <tr>
                <td align="center" class="smalltext"><b>{lang_mo}</b></td>
                <td align="center" class="smalltext"><b>{lang_di}</b></td>
                <td align="center" class="smalltext"><b>{lang_mi}</b></td>
                <td align="center" class="smalltext"><b>{lang_do}</b></td>
                <td align="center" class="smalltext"><b>{lang_fr}</b></td>
                <td align="center" class="smalltext"><b>{lang_sa}</b></td>
                <td align="center" class="smalltext"><b>{lang_so}</b></td>
              </tr>
              {calendar_data}
             

Fertig!
Done!

Nun kannst du {calendar} überall in deinen Template nutzen.
You may now use {calendar} anywhere in your templates.

DEMO: http://crazy-pics.de.vu/
DEMO2:   ;) http://photo.overlord.cz
MAяTRIX


Offline police22

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
    • The Dartez Page
Re: [MOD] Kalender / Calendar (by Cr@zy Sash)
« Reply #1 on: April 19, 2005, 04:26:45 AM »
Hey,
I just installed this "MOD" and im getting an error that is caused by the code that goes in the page header.php. i have the line in bold below

Originally posted/Author: Cr@zy Sash

1.)
Öffne die Datei includes/page_header.php und füge folgenen Code ein: /
Open includes/page_header.php and add this code:

//-----------------------------------------------------
//--- Calendar ----------------------------------------
//-----------------------------------------------------
....
    if($dum1==$dum2){
      if(($heute==6) || ($heute==7))else
      }
      else{
      if(($heute==6) || ($heute==7))else
      }
....
[

This is the error: Parse error: parse error, unexpected T_ELSE in C:\DartezWeb\DartezPix\includes\page_header.php on line 73
i tried deleting it and others but get more errors. not sure on what to fix.
BTW. Just thought of this.. if this is an old mod from Cr@zy Sash, then has it been converted to 1.7.1 or is it the same.. sounds like an version error???  :?:
Thanks

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Kalender / Calendar (by Cr@zy Sash)
« Reply #2 on: April 19, 2005, 04:46:36 AM »
that is screwed up... I dont even know what those conditions supposed to do....
martrix, would u look up in your page_header and repost whatever you have between:
Quote
for($i=1;$i<=31;$i++){
...
}
:?:
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline michi-w.

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [MOD] Kalender / Calendar (by Cr@zy Sash)
« Reply #3 on: April 19, 2005, 06:01:53 AM »
Ich habe das gleiche Problem (police22), was kann ich tun?
V@no Antwort habe ich nicht verstanden.

I have the same problem (police22), which I can do?
I did not understand V@no answer.


Gruß
michi-w.

Offline police22

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
    • The Dartez Page
Re: [MOD] Kalender / Calendar (by Cr@zy Sash)
« Reply #4 on: April 19, 2005, 06:44:20 AM »
Ich habe das gleiche Problem (police22), was kann ich tun?
V@no Antwort habe ich nicht verstanden.

I have the same problem (police22), which I can do?
I did not understand V@no answer.


Gruß
michi-w.

He was talking to Matrix to post his page_header.php between the 2 lines he mentioned to see how it is and how its working..
what version do you have? 1.7.1.???   :?:

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Kalender / Calendar (by Cr@zy Sash)
« Reply #5 on: April 19, 2005, 08:37:20 AM »
Well I did re-post the original mod I had saved from the old forum changing just some "gramatical" things ;)

A typo could happen whilst copy-pasting the code :(

I'll check that as soon as I have access to my files...
MAяTRIX


Offline michi-w.

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [MOD] Kalender / Calendar (by Cr@zy Sash)
« Reply #6 on: April 19, 2005, 01:07:53 PM »
Hello,

language is german, script is 1.7.
 
My page_header.php file, without mod.
http://www.web-upload.de/page_header.txt

Sorry for my bad english and thanks for the assistance.

Gruß
michi-w.

 

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Kalender / Calendar (by Cr@zy Sash)
« Reply #7 on: April 19, 2005, 08:51:06 PM »
Sorry guys! :oops:
Somehow all the {blablablasd f} parts of the code disappeared...

Please redo step 1. and 4.

BTW... my Page_header-Calendar-MOD Code looks like this, so you might like to use this:
The only difference: Instead of "Calendar" it shows the actual Month and year...  8)

Code: [Select]
//--- Calendar ---
$dat = time();
$dat0 = getdate($dat);

if ($dat0[mon]=="1"){$month_txt=$lang['lang_jan'];}
if ($dat0[mon]=="2"){$month_txt=$lang['lang_feb'];}
if ($dat0[mon]=="3"){$month_txt=$lang['lang_mar'];}
if ($dat0[mon]=="4"){$month_txt=$lang['lang_apr'];}
if ($dat0[mon]=="5"){$month_txt=$lang['lang_may'];}
if ($dat0[mon]=="6"){$month_txt=$lang['lang_jun'];}
if ($dat0[mon]=="7"){$month_txt=$lang['lang_jul'];}
if ($dat0[mon]=="8"){$month_txt=$lang['lang_aug'];}
if ($dat0[mon]=="9"){$month_txt=$lang['lang_sep'];}
if ($dat0[mon]=="10"){$month_txt=$lang['lang_oct'];}
if ($dat0[mon]=="11"){$month_txt=$lang['lang_nov'];}
if ($dat0[mon]=="12"){$month_txt=$lang['lang_dec'];}


$datj=$dat0[month]." ".$dat0[year];
if($calshow==""){$calshow=$dat0[month]." ".$dat0[year];}
$dath=$calshow;
$calshow="";
$dat5="1 ".$dath;
$dat1 = getdate(strtotime($dat5));
$dat2 = getdate(strtotime($dat5." -1 month"));
$datr=$dat2[month]." ".$dat2[year];
$dat3 = getdate(strtotime($dat5." +1 month"));
$datv=$dat3[month]." ".$dat3[year];
$erster=$dat1[wday];

if($erster!=1){
  if($erster==0){$erster=7;}
  $calendar_data = "<tr>";
  for($i=0;$i<$erster-1;$i++){$calendar_data .= "<td class=\"smalltext\">&nbsp;</td>";}
  }
for($i=1;$i<=31;$i++){
  $dat4 = getdate(strtotime($i." ".$dath));
  $heute=$dat4[wday];
  if($heute==0){$heute=7;}
  if($dat1[mon]==$dat4[mon]){
    $stil="calat";
    $dum1=$dat0[mday].".".$dat0[mon].".".$dat0[year];
    $dum2=$dat4[mday].".".$dat4[mon].".".$dat4[year];
    if($dum1==$dum2){
      if(($heute==6) || ($heute==7)){$stil="calht";}else{$stil="calht";}
      }
      else{
      if(($heute==6) || ($heute==7)){$stil="calwe";}else{$stil="smalltext";}
      }
    if ($i<=9){$k="0";}else{$k="";}
    if($heute==1){$calendar_data .= "<tr>";}
    $calendar_data .= "<td align=\"center\" class=\"".$stil."\">".$k.$i."</td>";
    if($heute==7){$calendar_data .= "</tr>";}
    $j=$heute;
    }
  }
if ($j!=7){
  for ($i=0;$i<7-$j;$i++){$calendar_data .= "<td class=\"smalltext\"></td>";}
  $calendar_data .= "</tr>";
  }
$calendar_data .= "</table>";

$calendar = $site_template->parse_template("calendar");
$site_template->register_vars(array(
    "calendar" => $calendar,
    "calendar_data" => $calendar_data,
    "lang_calendar_head" => $month_txt." ".$dat0[year],
    "lang_mo" => $lang['lang_mo'],
    "lang_di" => $lang['lang_di'],
    "lang_mi" => $lang['lang_mi'],
    "lang_do" => $lang['lang_do'],
    "lang_fr" => $lang['lang_fr'],
    "lang_sa" => $lang['lang_sa'],
    "lang_so" => $lang['lang_so'],
  ));
  unset($calendar);

the lang part:

English:
Code: [Select]
//--- Calendar ---
$lang['lang_calendar'] = "Calendar";
$lang['lang_mo'] = "Mo";
$lang['lang_di'] = "Tu";
$lang['lang_mi'] = "We";
$lang['lang_do'] = "Th";
$lang['lang_fr'] = "Fr";
$lang['lang_sa'] = "Sa";
$lang['lang_so'] = "Su";
$lang['lang_jan'] = "January";
$lang['lang_feb'] = "February";
$lang['lang_mar'] = "March";
$lang['lang_apr'] = "April";
$lang['lang_may'] = "May";
$lang['lang_jun'] = "June";
$lang['lang_jul'] = "July";
$lang['lang_aug'] = "August";
$lang['lang_sep'] = "September";
$lang['lang_oct'] = "October";
$lang['lang_nov'] = "November";
$lang['lang_dec'] = "December";

German:
Code: [Select]
//--- Calendar ---
$lang['lang_calendar'] = "Kalender";
$lang['lang_mo'] = "Mo";
$lang['lang_di'] = "Di";
$lang['lang_mi'] = "Mi";
$lang['lang_do'] = "Do";
$lang['lang_fr'] = "Fr";
$lang['lang_sa'] = "Sa";
$lang['lang_so'] = "So";
$lang['lang_jan'] = "Januar";
$lang['lang_feb'] = "Februar";
$lang['lang_mar'] = "März";
$lang['lang_apr'] = "April";
$lang['lang_may'] = "Mai";
$lang['lang_jun'] = "Juni";
$lang['lang_jul'] = "Juli";
$lang['lang_aug'] = "August";
$lang['lang_sep'] = "September";
$lang['lang_oct'] = "Oktober";
$lang['lang_nov'] = "November";
$lang['lang_dec'] = "Dezember";

and the template:

Code: [Select]
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 <tr>
  <td class="head2" height="20" width="135" colspan="7"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />::&nbsp;{lang_calendar_head}</td>
 </tr>
 <tr>
  <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
 </tr>
 <tr>
  <td align="center" class="smalltext"><b>{lang_mo}</b></td>
  <td align="center" class="smalltext"><b>{lang_di}</b></td>
  <td align="center" class="smalltext"><b>{lang_mi}</b></td>
  <td align="center" class="smalltext"><b>{lang_do}</b></td>
  <td align="center" class="smalltext"><b>{lang_fr}</b></td>
  <td align="center" class="smalltext"><b>{lang_sa}</b></td>
  <td align="center" class="smalltext"><b>{lang_so}</b></td>
 </tr>
{calendar_data}
MAяTRIX


Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: [MOD] Kalender / Calendar (by Cr@zy Sash)
« Reply #8 on: April 19, 2005, 09:01:48 PM »
Is there a way to put in dates, birthdays or other in the calender???

This where great....
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Kalender / Calendar (by Cr@zy Sash)
« Reply #9 on: April 19, 2005, 09:11:20 PM »
If you meant this "globaly" then yes  :wink: Everything you can imagine is possible... but...

...but if you did mean that question to this MOD: not without completely re-writing it  :(

This MOD only shows the days of the actual month in a table, nothing else...
MAяTRIX


Offline police22

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
    • The Dartez Page
Re: [MOD] Kalender / Calendar (by Cr@zy Sash)
« Reply #10 on: April 19, 2005, 10:45:25 PM »
Sorry guys! :oops:
Somehow all the {blablablasd f} parts of the code disappeared...

Please redo step 1. and 4.
...snip
Thanks Matrix  :) Gonna try installing again right now

Offline police22

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
    • The Dartez Page
Re: [MOD] Kalender / Calendar (by Cr@zy Sash)
« Reply #11 on: April 19, 2005, 11:15:37 PM »
 :evil: I dont know whats up with it.. got the new stuff install, but when loaded in the browser all there is a blue box with a :: inside think from the calendar.html tmp...  everything seems to look good..
{calendar} is what your suppose to put in the template where you want it, Right :?:
Take a look at http://dartezpix.servepics.com

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Kalender / Calendar (by Cr@zy Sash)
« Reply #12 on: April 19, 2005, 11:50:29 PM »
strange... I just tested all the steps on a fresh 4images install and it did work fine...  :|

The only thing I may ask you for is to reload this post and try to repeat all the steps again.
MAяTRIX


Offline michi-w.

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [MOD] Kalender / Calendar (by Cr@zy Sash)
« Reply #13 on: April 20, 2005, 02:28:30 AM »
It`s ok, thank you!

Bei mir ist nun alles in Ordnung, vielen Dank!

Gruß
michi-w.

Offline police22

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
    • The Dartez Page
Re: [MOD] Kalender / Calendar (by Cr@zy Sash)
« Reply #14 on: April 20, 2005, 03:48:18 AM »
strange... I just tested all the steps on a fresh 4images install and it did work fine...  :|
That wouldn't happen to be 1.7?

The only thing I may ask you for is to reload this post and try to repeat all the steps again.

Well i run 1.7.1 and it is NOT :cry: :cry: working...
HOWEVER. i did still have a back up copy of 1.7 in another folder and installed it.. Yep it worked, minus some formating issues..

NOW!!! my question which you probably already know.

What do/should i change to make this work with 1.7.1 if there is a possibility to do it at all.....

Thanks.

 

Post your comments here