JForm error when creating a joomla component - php

I'm new to joomla! extension development, and I'm developing a simple component,the idea of my component is to insert a couple of data into database. In the admin when people click on the new button it should enable them to insert values according to the form I created. Here is my problem when I click on the new button it show's me this error:
JForm::getInstance could not load file
So far i have created all the basic MVC model that the joomla! interface needs. Need help.
Thank you.(I'm using Joomla! version 3.0)

That error is because joomla is not loading your form correctly. Can't say anything else without looking at the code, sorry.
If you want to see how a component works with a clean, functional written code, check http://component-creator.com. It creates a complete component with CRUD functions in 5-10 mins.
Regards,
Andrés

Related

Joomla 3 registration form

On one of the sites i need to do some changes on for a client i am having trouble finding something.
On the standard Joomla 3 registration system a custom field was added to the form, but that form does not email to the admin when someone registers, please can someone point me in the correct direction on where i can make that field be sent in the email.
I have looks on quite a few pages on the net but have not come right with any of the answers that i found. I have also tried going to most of the php files to see if i cant find something but i am not having much luck.
Unfortunately that email is hard coded; it is really a legacy from Joomla 1.0. What you would probably want to do is turn off the core notification system and instead use a plugin that would be triggered with the onUserAfterSave event and use similar code to what is in the core. You will find that in the activate($token) method in the frontend registration model for com_users.
The plugins/user/joomla plugin gives an example of how to build an email, bit in your case you would want to build it when the user is created in the site application (isSite() == true). You can also look at the contactcreator plugin in the same folder; it also uses the onUserAfterSave event.

Create custom joomla captcha

I've been assigned to create a captcha verification for a custom component in joomla, but I'm stuck at how to do it properly.
I'm aware of the fact that there are many captcha plugins like recaptcha available but I am required to use a custom captcha created by the company.
It saves the image text in a session and creates the image in a component so calling index.php?option=com_captcha directly in the browser will output a captcha image.
The problem is that I'm completely new to joomla and can't seem to find a proper way to create code that could be reused through out the system. I tried to do this by creating a module that would call the captcha component, then do the logic and check if captcha was correct.
The problem I faced with doing this was the fact that I couldn't find a way to pass variables to my module, thus I couldn't pass the session variable that's required by captcha component.
I've looked at plugins but I'm not sure that you can call a plugin directly from a component.
I'm currently stumped and got no ideas which direction to go to and what to search for. Any help will be appreciated, thanks.
You don't mention your Joomla! version but if it's 1.6+ why not use a captcha plugin?
Then any third party extension can use it automatically if you set it as the sites default captcha mechanism.
Plugins are also a lot easier to write than a component... captcha plugins only have a few required methods — onInit($id), onDisplay($name, $id, $class) and onCheckAnswer($code)

run php function/script after save in joomla

I'm trying to figure out how to run a function/script as soon as an item is saved in joomla 2.5. Joomla's MVC structure is still rather complicated to me so I'm pulling my hair here trying to find out where this save event is triggered. Also I want to keep the code neat so I'm asking here for help.
Basically I want to run my own function (let's say emailUser() ) as soon as an item is saved in joomla. Currently there is no way for me to do "other stuff" when the save event is triggered.
I'm using a custom component generated with the component creator here:
http://www.notwebdesign.com/joomla-component-creator/
I heard that plugins are the solution, but I can't find any documentation on the save events and how to use a plugin to do this. Joomla's help forums aren't helping either. So basically I need a push in the right direction.
EDIT:
I've seem to found the toolbar which creates the save button, but that means that it's saved through the internal workings of joomla. It's in the view.html.php file. Any way of tapping into that with a custom function?
Inside the controller of the component (administrator/components),how about redefining the save event to be something like this:
$save =& JToolBarHelper::save('clientscan.save', 'JTOOLBAR_SAVE');
if($save)
{
JFactory::getMailer();
//emailing goes here..
}
After save would say use a postSaveHook in your controller.

Inline Editing (mojomotor like) for Code Igniter project?

So I've built my site in Code Igniter and there are a number of pages where I feel it'd be easiest if the client could edit the content inline - much like what MojoMotor offers.
I'm not interested in using mojomotor but I wondered if anyone had done anything like this for their code igniter project?
As an idea of how it could work:
I was thinking that the client admin user could login to the normal custom built admin CMS area. After logged in, with session set, they can browse out to the public site for selected pages.
These pages will have a check for that admin session built in and if it's present, it can include a js file, which will overlay an admin banner and somehow enable the fields (perhaps content divs with a certain id or class relating to the corresponding table/field in DB) for editing.
--EDIT--
I've seen quite a few js inline editors around. I guess my confusion is over how best to integrate them with my database and controllers - i.e. idea of having the div id/class somehow map to the db field.
The bottom line is that MojoMotor is a CodeIgniter app and not a library. Therefore trying to work the code into your existing CodeIgniter project is not really an option.
But if you're willing, you can integrate your CodeIgniter project into MojoMotor and have the benefits of both. Here is a series of articles written on how to do this.
This is one example of the code you are looking for . You'll have to adapt the method for use with CI

Custom php code in Joomla page

I'm trying to change the source of a table in a Joomla 1.5.9 page from hardcoded html in the page to getting the information from a SQL database. What is the proper way to do this? Create a new model or component and somehow use that in the page?
I found these:
http://docs.joomla.org/Tutorial:How_to_use_the_database_classes_in_your_script
http://docs.joomla.org/How_to_use_the_database_classes_in_your_script
But I'm not sure where to write the php code and how to access it in the page. If somebody could point me to a basic tutorial for custom php or whatever it's called, I'm new to webb development, I'd be happy.
You can use the Jumi extension to add custom PHP code to a Joomla page or module.
You Can install The Php Pages Component in joomla 1.5 .Where you can write your custom php code in joomla .
Also using this Php Pages Component you can Also write the query in the Php Code Itself.
So That you can extract the data from the database.

Categories