Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-03-2007, 10:46 AM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,071
Thanks: 53
Thanked 25 Times in 23 Posts
[SOLVED] Calendar as a sidebar module

Hi,

I´ve tried to put this localized JS calendar (Simple calendar setup [flat calendar]) of Mihai Bazon in a sidebar module.

Therefore I´ve coded this tpl file by trial and error:

Code:
{if $user_logged_in neq ""}

<div class="tlb">
	{php}
		echo "<span><a onclick=\"new Effect.toggle('cal','blind', {queue: 'end'}); \"> <img src=\"".my_pligg_base."/templates/".The_Template."/images/expand.png\"></a></span>";
	{/php}
	<a href="#">Kalender</a>
</div>

<div id="cal" style="padding-bottom:1px">
	<ul style="list-style:none;">
		{php}
  <link rel="stylesheet" type="text/css" media="all" href="calendar-win2k-cold-1.css" title="win2k-cold-1" />
  <script type="text/javascript" src="calendar.js"></script>
  <script type="text/javascript" src="lang/calendar-de.js"></script>
  <script type="text/javascript" src="calendar-setup.js"></script>

<div style="float: left; margin-left: 1em; margin-bottom: 1em;"
id="calendar-container"></div>

<script type="text/javascript">
  function dateChanged(calendar) {
    if (calendar.dateClicked) {
      var y = calendar.date.getFullYear();
      var m = calendar.date.getMonth();     // integer, 0..11
      var d = calendar.date.getDate();      // integer, 1..31
      window.location = "/" + y + "/" + m + "/" + d + "/index.php";
    }
  };

  Calendar.setup(
    {
      flat         : "calendar-container", // ID of the parent element
      flatCallback : dateChanged           // our callback function
    }
  );
</script>


		{/php}
	</ul>
</div>
{/if}
As expected, it doesn´t work. Can you help me to implement it?

Last edited by tbones; 07-06-2007 at 12:35 PM.. Reason: Changed link to author´s URL
Reply With Quote
  #2 (permalink)  
Old 07-03-2007, 12:04 PM
savant's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: UK
Posts: 1,218
Thanks: 64
Thanked 207 Times in 148 Posts
PHP Code:
{if $user_logged_in neq ""}

<
div class="tlb">
    {
php}
        echo 
"<span><a onclick=\"new Effect.toggle('cal','blind', {queue: 'end'}); \"> <img src=\"".my_pligg_base."/templates/".The_Template."/images/expand.png\"></a></span>";
    {/
php}
    <
a href="#">Kalender</a>
</
div>

<
div id="cal" style="padding-bottom:1px">
    <
ul style="list-style:none;">
  <
link rel="stylesheet" type="text/css" media="all" href="calendar-win2k-cold-1.css" title="win2k-cold-1" />
  <
script type="text/javascript" src="calendar.js"></script>
  <script type="text/javascript" src="lang/calendar-de.js"></script>
  <script type="text/javascript" src="calendar-setup.js"></script>

<div style="float: left; margin-left: 1em; margin-bottom: 1em;"
id="calendar-container"></div>

{/literal}
<script type="text/javascript">
  function dateChanged(calendar) {
    if (calendar.dateClicked) {
      var y = calendar.date.getFullYear();
      var m = calendar.date.getMonth();     // integer, 0..11
      var d = calendar.date.getDate();      // integer, 1..31
      window.location = "/" + y + "/" + m + "/" + d + "/index.php";
    }
  };

  Calendar.setup(
    {
      flat         : "calendar-container", // ID of the parent element
      flatCallback : dateChanged           // our callback function
    }
  );
</script>
{/literal}
    </ul>
</div>
{/if} 
try that
__________________
Anatomy of the Pligg template Help needed
Reply With Quote
  #3 (permalink)  
Old 07-03-2007, 12:25 PM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,071
Thanks: 53
Thanked 25 Times in 23 Posts
result:
Fatal error: TPL: [in yget/sidebar_modules/sidebar_calendar.tpl line 19]: syntax error: /literal function does not exist (class.compiler.php, line 485) in /srv/www/www-netbi-blog/http/blog/bewertung/class.template.php on line 923

Maybe a typo?
Reply With Quote
  #4 (permalink)  
Old 07-03-2007, 03:54 PM
savant's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: UK
Posts: 1,218
Thanks: 64
Thanked 207 Times in 148 Posts
yeah, my bad

PHP Code:
{if $user_logged_in neq ""}

<
div class="tlb">
    {
php}
        echo 
"<span><a onclick=\"new Effect.toggle('cal','blind', {queue: 'end'}); \"> <img src=\"".my_pligg_base."/templates/".The_Template."/images/expand.png\"></a></span>";
    {/
php}
    <
a href="#">Kalender</a>
</
div>

<
div id="cal" style="padding-bottom:1px">
    <
ul style="list-style:none;">
  <
link rel="stylesheet" type="text/css" media="all" href="calendar-win2k-cold-1.css" title="win2k-cold-1" />
  <
script type="text/javascript" src="calendar.js"></script>
  <script type="text/javascript" src="lang/calendar-de.js"></script>
  <script type="text/javascript" src="calendar-setup.js"></script>

<div style="float: left; margin-left: 1em; margin-bottom: 1em;"
id="calendar-container"></div>

{ literal }
<script type="text/javascript">
  function dateChanged(calendar) {
    if (calendar.dateClicked) {
      var y = calendar.date.getFullYear();
      var m = calendar.date.getMonth();     // integer, 0..11
      var d = calendar.date.getDate();      // integer, 1..31
      window.location = "/" + y + "/" + m + "/" + d + "/index.php";
    }
  };

  Calendar.setup(
    {
      flat         : "calendar-container", // ID of the parent element
      flatCallback : dateChanged           // our callback function
    }
  );
</script>
{ /literal }
    </ul>
</div>
{/if} 
__________________
Anatomy of the Pligg template Help needed
Reply With Quote
  #5 (permalink)  
Old 07-03-2007, 04:04 PM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,071
Thanks: 53
Thanked 25 Times in 23 Posts
no error message anymore but also no display :-(

Just an empty sidebar module!

Edit: Could it be a problem with the size of the calendar? It should fit but maybe the padding for a module is too much.

Last edited by tbones; 07-03-2007 at 04:07 PM.. Reason: size problem
Reply With Quote
  #6 (permalink)  
Old 07-03-2007, 05:08 PM
savant's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: UK
Posts: 1,218
Thanks: 64
Thanked 207 Times in 148 Posts
is the path for all the javascript file right??
__________________
Anatomy of the Pligg template Help needed
Reply With Quote
  #7 (permalink)  
Old 07-04-2007, 03:44 AM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,071
Thanks: 53
Thanked 25 Times in 23 Posts
Yes, see the link at the top: it´s directly inside the sidebar_modules folder. Otherwise I hadn´t get any error messages before.

What about making the sidebar wider? Where is the value that sets the width of the sidebars?
Reply With Quote
  #8 (permalink)  
Old 07-04-2007, 03:48 AM
savant's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: UK
Posts: 1,218
Thanks: 64
Thanked 207 Times in 148 Posts
standalone version might work but when adding it into pligg, the url will be

Pligg Lernumgebung @ TU KL / Schlagzeilen

and it looks for the js files in Pligg Lernumgebung @ TU KL / Schlagzeilen rather than in the sidebar_modules folder.
__________________
Anatomy of the Pligg template Help needed

Last edited by savant; 07-04-2007 at 03:52 AM..
Reply With Quote
  #9 (permalink)  
Old 07-04-2007, 03:55 AM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,071
Thanks: 53
Thanked 25 Times in 23 Posts
So I have to add a relative path in front of every file referenced in my tpl file?
Reply With Quote
  #10 (permalink)  
Old 07-04-2007, 06:45 AM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,071
Thanks: 53
Thanked 25 Times in 23 Posts
Or would it be better to set a path variable?
Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
Fixes to Profile Extra Fields Module v0.2 and Extended Profile Module v0.1 redwine Modification Tutorials 3 10-18-2008 10:28 AM
Help needed with code insertion into sidebar module. jemaverick General Help 3 03-27-2008 01:27 PM
Google Translate v0.1 Sidebar Pligg Module pliggedit Modification Tutorials 3 03-16-2008 02:57 AM
Sidebar Friends Module with messaging and activity AnAlienHolakres3 Modification Tutorials 31 02-09-2008 06:54 AM
differents class for sidebar module lacasuela "yget" 5 01-21-2008 02:32 PM


Search Engine Friendly URLs by vBSEO 3.2.0