Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

error in site model function + solution 23 Nov 2012 22:02 #5628

  • aria
  • aria's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 3
i try to save a record from my model using an auto-build model. it is on the site-part.
one of the fields is a date field.
i get an error: Class JDate not found at helper.php at line 336.

solution:
add the line: jimport( 'joomla.utilities.date' ); at the top of the model with the save function

this should be added in the auto-build function

Please Log in or Create an account to join the conversation.

Re: error in site model function + solution 02 Dec 2012 15:13 #5729

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Stange that it doesn't.

Wich PTL please ? (Project / Table / Layout)
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Re: error in site model function + solution 02 Dec 2012 16:08 #5733

  • aria
  • aria's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 3
Project: Leerling
Table: Bloon datums

In frontend:
I have no view in the project, i have a view from within my other project (not within Cook)
I use:
JLoader::import( 'bloondatum' , JPATH_SITE_LEERLING . DS . 'models' );
$model_datum = JModel::getInstance('bloondatum', 'LeerlingModel');
$data = array(..........);
$model_datum->save($data);

Then i get an error: Class JDate not found at helper.php at line 336.

I can correct it when i load jDate in my model, but that is not the correct way, i think.
The load of jDate should be in the models bloondatum.php and bloondatums.php

Please Log in or Create an account to join the conversation.

Re: error in site model function + solution 02 Dec 2012 20:18 #5739

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
This is old and closed now.

The date functions are now handled in helpers/dates.php
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Re: error in site model function + solution 02 Dec 2012 20:43 #5741

  • aria
  • aria's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 3
This is not a friendly answer.
It gives an error when i posted the problem, and it is solved now...
The answer you give suggested something else.

Anyway: it is solved

Please Log in or Create an account to join the conversation.

Re: error in site model function + solution 02 Dec 2012 21:26 #5743

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
There was no aversion in my answer it was not my intention.
I profundly apologize. Sometimes the language is making confusion.
I should have ask you before the version you was running.

I didn't uploaded anything today.
When I say it was closed, I do not reffers to an existing topic. Your catch is good. I only say that I remember now it is working differently, so the issue cannot be raised anymore. (I only fix on V2.0)

I explain :

a helper is extending the native functionalities of the JDate. In version 1.5 it was in helpers/helper.php, and now it is in helpers/date.php

...and also, I access now with $date = JFactory::getDate() wich instanciate automatically the line you have mentioned.
The first thing I did before to answer you was to add you a point of Karma, so my intention was really to thanks you.

By the way, what is the JLoader for ?
JLoader::import( 'bloondatum' , JPATH_SITE_LEERLING . DS . 'models' );
Still learning...
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Re: error in site model function + solution 02 Dec 2012 21:32 #5744

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
leerling is dutch, means student, college pupil... élève quoi...
bloon... don't know... code name for the project maybe ? ;)

Please Log in or Create an account to join the conversation.

Re: error in site model function + solution 02 Dec 2012 21:49 #5749

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986

VeCrea wrote: leerling is dutch, means student, college pupil... élève quoi...
bloon... don't know... code name for the project maybe ? ;)


:lol: I was speaking about JLoader.

After a simple search :
developer.joomla.org/manual/ch01s04.html

Since Platform 11.4
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Re: error in site model function + solution 02 Dec 2012 22:02 #5752

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
i only help where i can ;)

Please Log in or Create an account to join the conversation.

Re: error in site model function + solution 02 Dec 2012 22:12 #5754

  • aria
  • aria's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 16
  • Thank you received: 3
Sorry for the too quick reaction. I did post the error on 24 nov and it is fixed 2 dec. But that is not important any more. Thanks for your explanation.

The line: JLoader::import( 'bloondatum' , JPATH_SITE_LEERLING . DS . 'models' );

I have made two components:
- leerling
- leerlingbloon

The component leerling is handling all the database work and is a unchanged Cook component
The component leerlingbloon is my component and have extra views on the database tables from leerling.

I choose to set the extra views in a different component. By that way i can change the leerling component without integrating every time my own views.

The way of calling the classes:
leerlingbloon->myview calls leerlingbloon->mymodel
leerlingbloon->mymodel extents leerling->autocreatedmodel

The line: JLoader::import( 'bloondatum' , JPATH_SITE_LEERLING . DS . 'models' );
makes it possible to use the model bloondatum from component leerling in the component leerlingbloon

(in my leerlingbloon.php i define the constants and load the leerling-helper)

In short: it is my way to split the part Cook generated and the part I added


(For VeCra: bloon is a system for childs of 6 to 12 year to learn words)

Please Log in or Create an account to join the conversation.

Re: error in site model function + solution 02 Dec 2012 22:22 #5758

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Nice work! I'm sure that's a great tip for some of those banquet chefs here cooking up massive 10k + point projects that need to split them apart!!!

Thanks @ aria!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

Re: error in site model function + solution 02 Dec 2012 22:30 #5759

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Yess, this is very good !!
I often split my projects same as you. It is the best to work faster, even if it makes it more difficult to deploy.
A main component (unchanged after generation) is handling the MVC layer, and a second one is picking the strict necessary and customizing the views and specific code.

JLoader seems amazing. Must check it out and check complete compatibility and standard for Cook.
This is a very good contribution. K+1 again
Usually, in my 'sattelite' component, I always have a long list of includes. do you mean with JLoader we can make it easier and avoid theses implementations ?

Incredible.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Re: error in site model function + solution 03 Dec 2012 16:25 #5793

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
off-topic mode ON :
Een soort globale methode om te leren lezen ? Mijn zoon gaat vanaf january 2013 op school (pleuter maar) in het nederlands, ondanks we thuis franstalligen zijn
off-topic mode OFF

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.088 seconds

I have to say your builder is great! We use for another project in a week we have the system built. For the J!Boleto I convert to j3 in 2 weeks :)
Luiz Felipe Weber 

Get Started