JHTML::_('calendar' is in 1.6 not running but in 1.5

Joomla versions 2.5, 1.7 and 1.6 are all end-of-life since December 31st 2014 and are no longer supported. Please use Joomla 3.x instead.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
ShopperJeanny
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Wed Jul 07, 2010 1:08 pm

JHTML::_('calendar' is in 1.6 not running but in 1.5

Post by ShopperJeanny » Sun Mar 13, 2011 5:38 pm

Hello,

I wrote a module what I updated to Joomla 1.6. Everything is fine running, except the calender.
In my 1.5 version in the default.php I used the standard calendar from Joomla, but now I get the following error:
The error message:
After showing the Patienten-Nummer label and field the message is:
Fatal error: Using $this when not in object context in C:\xampp\htdocs\joomla16\modules\mod_bachbar\tmpl\default.php on line 29

Line 29 is: echo JHTML::_('calendar'

My default.php

Code: Select all

<?php
  defined( '_JEXEC' ) or die( 'Restricted Access' );
  JHTML::_('behavior.tooltip');
  JHTML::_('behavior.calendar');

   // get url
   $instance =& JURI::getInstance();
   $url = JURI::getInstance()->toString();
    ?>
    <div>
      <form action="<?php echo JRoute::_($url); ?>" method="post">
        <p>
                <span><label for="nummer">Patienten-Nummer</label><br /></span>
                <input id="pnummer" name="pnummer" type="text" value="" size="10" />
                <br />
        </p>
        
        <?php

        //Joomla Kalender Start Datum
        echo JHTML::_('calendar'
          , $this->article->publish_up
          , 'publish_up'
          , 'publish_up'
          , '%d.%m.%Y '
          , array('class'=>'inputbox', 'size'=>'25',  'maxlength'=>'19')
        );
        //Joomla Kalender End Datum
        echo JHTML::_('calendar'
          , $this->article->publish_up
          , 'publish_end'
          , 'publish_end'
          , '%d.%m.%Y '
          , array('class'=>'inputbox', 'size'=>'25',  'maxlength'=>'19')
        );

        ?>
        <input class="button" type="submit" value="Go">
      </form>
    </div>

    <?php

    if ($_SESSION['phase2'])
    {
        $phase2 = false;

      if (isset($beschreibung))
      {
        foreach ($beschreibung as $row)
        {
          echo "<b>Deutscher Name </b>: ". $row->Deutsch_Name .'<br />';
          echo "<b>Englischer Name </b>: " . $row->Name_Englisch.'<br />';
          //echo "<b>Sonstiges </b>: " .$row->Sonstiges.'<br /><br /><br />';
        }
      }
    }
 ?>
Can you please help me? How can I create the instance?
Thanks in advance :)

grvulture
Joomla! Intern
Joomla! Intern
Posts: 60
Joined: Thu Apr 24, 2008 4:29 pm

Re: JHTML::_('calendar' is in 1.6 not running but in 1.5

Post by grvulture » Mon Mar 14, 2011 7:03 pm

What Joomla doesn't like is the $this->article->publish_up part.

You cannot refer to $this anymore in your module, nor can you access the $item variable (which has replaced the $article in Joomla1.6), as it is a protected variable now. Furthermore, the ContentView class seems to have been replaced by JView.

In other words... good luck! I don't know how you can get the article properties anymore, but what I know for sure is you cannot use $this->article->publish_up

ShopperJeanny
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Wed Jul 07, 2010 1:08 pm

Re: JHTML::_('calendar' is in 1.6 not running but in 1.5

Post by ShopperJeanny » Wed Mar 16, 2011 10:22 am

Does someone have a solution for me?
How would you make a "input field as a date" in a form with a calendar function in Joomla 1.6?
I think that it will be better than in Joomla 1.5, but I am wondering how I can do it...

Is there somewhere an example in Joomla 1.6, I couldn´t find one...
thx

knigherrant
I've been banned!
Posts: 2
Joined: Tue Aug 30, 2011 7:05 am
Location: HCM
Contact:

Re: JHTML::_('calendar' is in 1.6 not running but in 1.5

Post by knigherrant » Tue Aug 30, 2011 7:43 am

This code use to joomla 1.6

Code: Select all

echo JHTML::calendar('2011-08-30', 'publish_down', 'publish_down', '%Y-%m-%d',
				array('size'=>'12',
				'maxlength'=>'10',
				));

sey50
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Nov 18, 2011 1:24 am

Re: JHTML::_('calendar' is in 1.6 not running but in 1.5

Post by sey50 » Fri Nov 18, 2011 1:31 am

Hi,
Can u help me with jcalendar?
I want to used an event like onClick.
I dont want to use event onChange, cos it difficult when i want to get the date from the previous month.
But when i using event onChange it will do every event when i’m click to the previous month. However, i’m not click the date that i want yet but it’s do the event onChange already.

Do anyone have any idea?
Help me please…


Locked

Return to “Migrating and Upgrading to Joomla! 2.5”