extract information from Joomla Portal (Joomla module) - php

I have a PHP app, and I want some of the latest data to be extracted and display on a Joomla portal. I just couldn't figure out, can I return an XML document or what is the best way to do?

You can return these information in XML format and for example: snJxml2xslt2joomla
You can also return these information in RSS format and use the standard RSS feed module to show it in Joomla!
Or do you want to show some information FROM the Joomla site on an other site?

I'll assume that you want to display the information within a module in Joomla. If that's the case, then you can write your own database connection code (or override Joomla's) and pull the data directly out of the PHP application's database (assuming it's in a database).
If it's not, then there are several RSS/XML parsers within Joomla that will work such as the XML-RPC.

I would suggest to run a cron job to pull a data on regular basis and insert it into your local joomla portal DB. This way you have greater control over what you'd want to do with the data.
This might not be the best solution though. It also greatly depends on the kind of information you'd want to bring across. XML could be a bit more involved in terms of getting the structure right and so on.

Related

Aggregating data from a RESTful API

I am on a mission to understand how to pull data from a RESTful API, parse it, store it in a database in iterations and make the most recent parsed data available for retrieval on a website.
Problem is, I have no earthly idea how to do it!
If someone could provide some simple example codes and tie it all together that would be much appreciated. The most important thing to me is understand how to grab data, how to parse it, then how to display that on a website and grab data based on what users want.
I have an example project that you can look at (https://github.com/fuzzysteve/FuzzMarket) <-- This is essentially what I am trying to accomplish. I understand how the author uses twig framework for php for template. What I don't understand is everything else.
Who does php actually interact with and obtain the data for display?
How is the data parsed and stored?
What server-side applications is he using? So far I have identified twig, but I am at a loss for what else is being used besides a web server, some form of database, php and python.
Thanks,
XeroCo

I am building a small web application and i want to use JSON API to bring in Wordpress posts into my web app

So I am building a small web app. I have set it all up on Ubuntu and I am using Wordpress. I want to use a plug-in called JSON API to pull in content from my Wordpress blog in an easy to read form and I want this to be updated to say have only 5 posts at a time being the 5 most recent ones. I’ve looked around and I was wondering if someone could help me and give me an idea on how to go about this? I am a complete beginner I have no previous experience I have not started typing any codes or anything like that because I'm not sure how to start it.
You have a few options here, and which one you choose really depends on what works for you.
WordPress has a built-in API, but this is not a JSON API, it's XML-RPC. It's pretty feature-rich and won't require you to write any code (on the WP side) to pull posts. More info here: http://codex.wordpress.org/XML-RPC_Support
Read directly from the database. This is probably a faster implementation if you're reading from the same box. Simply connect to the database WordPress uses and query the posts table directly.
Find a JSON API plugin that suits your needs. It's difficult to recommend any as you seem to have specific requirements. Try some, and see what works for you. The downside to this is you'll need to keep the plugin up-to-date, and you're using third-party code - I'll leave it up to you whether you believe that to be a bad thing or not.
Write your own! It should be relatively straightforward to write a small script to pull in posts from the WordPress database and spit out a well-formed JSON feed.

joomla integrate dynamic php pages to project

I am trying to integrate to a joomla project, a list of php pages setup that update their content from db, and give select options to the user, to navigate through this content. Select is also dynamic. All dynamic features work with url parsing.
For example, pageone.php gets some data from db and creates a list of selectable links to page2.php?data=fetcheddata. Page 2 gets url variables and performs queries to db to select the data.
How am I going to integrate this to Joomla? Should I make a module to include the basic php page, and how url parsing will then work? Should I make an i-frame wrapper? Please enlighten me..
You just described the way Joomla works. Depending on the content you want to present, there may already be an extension that does that, or at least does something close that can be modified. Without any more details it is hard to say, but what you are describing could probably be accomplished with a CCK http://extensions.joomla.org/extensions/news-production/content-construction. You could definitely do it with a combination of Chronoforms and Chrono Connectivity -
http://extensions.joomla.org/extensions/contacts-and-feedback/forms/1508
http://extensions.joomla.org/extensions/directory-a-documentation/faq/5661
If not, then you will probably need to code a component - http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1
1) iframe solution is the easiest one. But it has its limitations...
2) you can write Joomla component (not a module) that will do the job, but I'm afraid in this case you will either have to switch to Joomla URL format... unless you find some trick how to workaround that.
If your site is not very complex a simple approach is to write your application in plain php, and integrate your Joomla template to your application so your visitors can't tell any difference. Then, you will place links from your Joomla to your application and vice-versa accordingly.
However, the best approach if you are more familiar with Joomla is to develop a component. Here you can understand the difference between Joomla Components, Modules and Plugins. Please read Joomla documentation for further understanding:
http://docs.joomla.org/Extension
http://docs.joomla.org/Component

Drupal / ubercart remote node addition

I am developing my first large Ubercart site, which needs to have a daily product database update from an existing xBase (DBF format). The conversion from DBF to MySQL/PHP is handled on the same server as the Drupal installation, using some custom scripting I have done, and works well. However, the next step is to get my script to talk to Drupal and update the product nodes with pricing/stock level/etc.
Googling hasn't resulted in any good hits, at least in PHP terms.
So how do I go about this? Can I just use a POST to a particular page in Drupal, ie RESTful, or do I have to use some more arcane xmlrpc method?
There's a couple ways to approach this. If you need to de-couple your import system from php you could create a api that would allow you products to be updated from an authenticated data provider.
http://drupal.org/project/services
The simpler method though is if your working in php you should bootstrap drupal and insert / update the nodes from php:
Here's a great howto on doing that: hxxp://www.group42.ca/drupal_command_line_script_template

Drupal form requests external api

I need a multi-page drupal form that requests an external xml api and displays the data on the second page of the multi-page form.
I'm new to drupal and I've been reading advices on here and on drupal.org. I think I can either use the computed field on cck or I write an module to do this. I think I will do both, first using the computed field then write a module later on to get things running sooner.
I need some advice on how to create a computed field that calls an external api. Do I use curl or is there a drupal function that I can use? What drupal documents would help me and is it possible to provide a simple snippets to help me get started?
example api call
https://my.example.com/XMLServices/xml?accessKey=&accountId=&form_var1=&form_var2=&form_var3=
Edit: I think its called REST api. I believe there are some modules that can help.
There are some computed field snippets here
Curl should get data (if it is restful) but you will still have to parse the result.
Personally I would go down the route of using a custom module and hook_nodeapi or hook_form_alter, rather than a computed field, as it sounds like you are wanting some quite custom functionality.
As for retrieving (and/or posting/putting) remote content from/to a REST interface (or anything else done via http), you should also take a look at the drupal_http_request() function. It can get you pretty far without having to go the curl route.
You can find a basic usage example in the aggregator_refresh() function in the aggregator module from Drupal core, where it is used to fetch RSS feeds.

Categories