Convert PHP/AJAX script to Joomla module?

For Joomla! 1.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Locked
auromak
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Sat Oct 25, 2008 8:47 pm

Convert PHP/AJAX script to Joomla module?

Post by auromak » Sat Oct 25, 2008 9:01 pm

Hi, I'm pretty new to Joomla, and am hoping to get pointed in the right direction to figure something out. I want to turn a php/ajax script into a Joomla module. Full integration with admin panel customization and such would be fantastic, but at this point, I just want to make it work on my joomla page. I'm assuming (hoping) that some pretty minor changes are all that will be needed, I'm just not sure where to even begin.

The script is pretty simple, consisting of a .js, .php, and a .css

Does anyone have any advice, or a good direction for me to start digging?

Thanks in advance!

lsmod
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Fri Nov 07, 2008 12:20 am

Re: Convert PHP/AJAX script to Joomla module?

Post by lsmod » Wed Nov 12, 2008 7:34 pm

To output ajax query result, the good way it's to make a component (not a module)
with a raw view, to get only the result only an not all the html page.
(if you dont ask an other website, and you make the result yourself)

Component it's good also for friendly admin.

So you should look for MVC joomla! development
http://www.vojtechovsky.net/joomla/comp ... de-en.html

basically you should make:
a view to show your content (html js and css)
and an other one for ajax result in a blank document (raw.view.php)

Code: Select all

$document->addScript('yourjs.js');
to add

Code: Select all

<script text/javascript> 
html balise in your document.

I dont know your level in joomla! dev, it's just some advice where you should look for documentation.

I help this will help you

stephencollier
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Fri Nov 14, 2008 1:33 am

Re: Convert PHP/AJAX script to Joomla module?

Post by stephencollier » Fri Nov 14, 2008 11:59 pm

Creating a module vs a component seems to depend on
* how much admin control you need
* whether you want to have the custom part have its own page or let it fit into parts of other pages

The modules fit into parts of other pages. I guess you could create a blank article and put the module into that article... I don't recall if there's a spot in the content area where the modules can fit into.

Modules are much easier to create than components. You can have admin-controlled fields by adding them to the install XML file. Modules are basically one PHP & one XML file. The admin of the module is handled automatically. I just copied one of the existing modules (mod_poll I think) and edited it. You just dump the PHP & XML files into a zip file and upload it to install the module.

Components have a complicated Controller-Model-View way of doing things. And you have to have the component (with CMV) that the users see plus an admin component (with CMV) to control it. There might be an easier way to create components without the CMV way of doing it, but I'm not sure... still kinda new to this stuff. I downloaded the Hello World tutorial and modified it to make the component I'm working on. It's taken me two weeks of working a few hours a day to read it all & dig into it to understand it & I'm not done yet.

I guess I would advise starting with a module & see if that satisfies your needs. Use the existing stuff to save yourself some major headaches.

auromak
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Sat Oct 25, 2008 8:47 pm

Re: Convert PHP/AJAX script to Joomla module?

Post by auromak » Tue Nov 18, 2008 11:39 pm

Thanks for the replies! Some good info and suggestions to help get me started. Thanks again! :D

tyagi.akhil
Joomla! Apprentice
Joomla! Apprentice
Posts: 35
Joined: Mon Nov 19, 2007 9:47 am

Re: Convert PHP/AJAX script to Joomla module?

Post by tyagi.akhil » Thu May 20, 2010 12:07 pm

This post will help you incorporate ajax.
http://forum.joomla.org/viewtopic.php?p=1173265


Locked

Return to “Joomla! 1.5 Coding”