How to load content from another Joomla database - joomla

I have two Joomla websites of related organisations: J1 and J2.
How can I load the content and title of an article which is stored in J2 to show in J1?
I can access configuration.php of J2 and get its database connection details or type it myself.
Also this probably would have to be some kind of plug-in where one just type:
{getExternalArticle=id} within the body of any content in J1.
Any suggestions for the best approach?

See this for reference:
http://docs.joomla.org/Connecting_to_an_external_database
Creating a content plugin:
http://docs.joomla.org/J1.5:Creating_a_content_plugin
This is specific to the old Joomla 1.5 and there are a few differences in 2.5 and the above is the use of JFields instead of JParameters in xml declaration and in the name of the events.
You can see more details on this here:
http://www.inmotionhosting.com/support/edu/joomla-25/create-plugin
This might be useful too:
How to get article text by article ID in Joomla?

You might want considered writing a program (perhaps in PHP) that could run as a CRON job and with authorization credentials to access the MySQL TABLE(s) needed from the other site to pull in those Joomla articles and have it populate the website so it could be displayed properly. I am making an assumption that one website has updates and you want them display on the other website, so I would look as a method for one site to feed another.

Related

Joomla passing parameters when calling an article

I want to know how I can modify an internal link from an article so as to pass a parameter to a scrap of PHP code in the destination article.
The PHP code embedded in the destination article will use the parameter to identify a record in a database table, then retrieve some data and display it in the article. It is all working, except for passing the parameter from the source article, and retrieving it in the destination article.
I'm using Joomla 2.5.7, with the DirectPHP plugin to embed the PHP code directly into the destination article.
You might want to look at K2 for Joomla to do this. It has K2 Items which are are like Joomla Articles but have additional fields in them and you can also add extra-fields from the back end.
http://getk2.org

Managing contents in multilingual stores in Magento

This might be a basic question, I'm still relatively new to Magento. I have 2 store views in a magento project. 1 for English (default) and 1 for Japanese. While working with both store views, I noticed how if for example I switch to the Japanese store view, if I redirected to a different page or content on the store, the language goes back to English. How do I prevent the website from going back to the default language every time I change categories/catalogs?
That is all about Magento Admin setting. While creating Content Pages/Categories/products, there is a option that ask to choose Store View.
You can add content for Cateogries/Product/CMS Pages for each locale. If it is done then you'll be able to see your site content on the basis of current locale. Hence you need to go through Magento Admin first.
Hope it will work for you. Please let me know if any issue.
Managing contents in multilingual stores in Magento is easy.
Edit/Create Product/Category/Page/Static blocks according to need storeview and put content according to languages in that.
Now access pages by store code, if we are using that.
In some case we don't find the heading names according to languages so just enable inline translater from admin and do translation specific to store/website.
To run Magento store using urls we have both options index.php modifiction and using .htaccess using website and store codes.
On running Magento multisite , multistore. We generally face the common urls for media, js and other resources we should use symlink to increase SEO ranking and score.
Please feel free to contact.
Install your language package.
Create products, categories, pages, and static blocks on the basis of your selected language.
Sometimes translation does not work for few words. In those cases, Inline translation from admin will help you.
Managing content according to store view is very easy.
follow up below steps for managing content according to Store view.
Edit your product or category or your page and static block etc.
after that you can see store select left side in product and category and on page you can see feild below url in static block also. select your store view.
whater ever you want to change or edit please do according to you.
After that save it will apear only on your selected store.
Note: if you not edit any fild by store then it will show default store contents.

adding data directly to a magento database

I am adding regions of a country to the database in Magento so when a user selects their country a relevant list of regions will be available in a drop down menu. To do this I believe I need to add information to directory_country_region and directory_country_region_name.
The tutorial I've been looking at states that I should add them directly to the database using sql, however I remember reading that you should not place information directly into the database using raw sql when working with Magento.
My questions are:
1- to keep in line with best practices do I need to use some magento functions to add the required information to my database or can they be dropped in using raw sql?
2- if I need to use some Magento functions how do I work out which I need to use (I have heard off and noticed the lack of documentation) or is there some online reference, even if it is limited?
3- if I am not to use a sql query why is it considered bad practice to do so in Magento?
Hello, if you want to add the information just once, you can use raw sql (faster and no drawbacks), also you are right about the 2 tables (if the country is already in directory_country). If you want to make something that will be available for more Magento instalations you have to crate a new Magento module and add the sql using the installer you can read more here http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-6-magento-setup-resources
Magento wiki is a good place to start, also there are lots of blog posts.
It's considered a bad practice because Magento has its own ORM and most of the time for your new tables (entities) you only need to create models that extend magento core models and you will have access to CRUD without any development and everyone that uses your new module will understaind what's going on.
Example for a region you can use the class Mage_Directory_Model_Region or for a collection of regions Mage_Directory_Model_Resource_Region_Collection

How do I transfer items from K2 to Joomla articles or wordpress ? What is the most wise choice?

I feel fed up with the Joomla K2 extension. This is the most crappy extension I've ever used and I am tired of correcting mistakes and bugs all the time. Even in the K2 forums, most of the threads suddenly and strangely disappeared, leading google results to 404 pages.
I did the most foolish thing on joomla: I installed their extension in joomla 1.6 because I wanted to set featured images in every article and joomla didn't have something like that (and then upgraded to 2.5) . So I created a news portal that publishes about 6 articles (or K2 items) every day for a year. So far there are 10 categories, 1000 articles and 200 tags (and 4 users only). There is nothing complicated on the website and all components are used "as they are". I haven't even used K2 extra fields etc.
I desperately want to transfer all items, categories, tags and images from K2 to Joomla articles. Then I will upgrade to the new Joomla 3.0. If I had a choice, I would transfer all data to wordpress. I have no money to hire an experienced developer and I have advanced programming knowledge but I am not an expert. I can try to copy data from one column to another but I would really appreciate the opinion of a developer with a "strong" knowledge.
On Joomla's forums it says that:
K2 articles are stored in the table jos_k2_items. Use a sql query to
copy them to jos_content.
INSERT INTO ###_content (title, alias, catid, published, introtext, fulltext)
SELECT title, alias, catid, published, introtext, fulltext
FROM ###_k2_items ;
This was posted about Joomla 1.5 Check the new table structure and make the necessary changes.
I'm not sure are you still looking for the answer, but maybe others do.
In case you want to move your K2 to WordPress, there's a plugin at the WordPress plugin directory for an automated migration. It supports the import of different type of content including categories, tags, menus and other, so it might answer your request.
The quick guide to the process includes the following steps -
You install the plugin on your WP website
Create the account at the service
Download the extension and install it at your K2 website
Choose the entities you want to migrate
Try the trial migration (it migrates 10 posts)
If you like it you can try the full migration (it's not free)
You may refer to this for more info, plus, this service is also represented in WordPress Codex.
Hope it helps.

Joomla front end has no content after web server move

I am so stumped with this and I need some help from the community. I moved my joomla site over to a new server and now the content has disappeared from the front end, I am not getting an errors.... Can someone offer any suggestions on where to look for the problem? my config is fine and I am pretty sure my database is aswell because all my original articles are there.
I am running Joomla 1.5
The URL: http://www.davidjamesmedia.ca
If you moved to a new server at a different hosting company, Joomla is probably either
not looking in the right place for the database, or
not using the right credentials (host, port, username, password, whatever) for the database.
That might also be true if you moved to a different server at the same hosting company, although it's a little less likely. Look at the configuration.php file.
Assuming you have shell access, make sure you can access the database through its command-line utility. Then make sure Joomla is using the same credentials.
This is a really odd one.
The database credentials are obviously correct otherwise the site wouldn't load at all and would result in a MySQL error. Try re-assigning a new temporary article to the homepage else download the K2 component, import your articles and assign the K2 article to the homepage.
Update:
If you have the demo package for the template you are using the follow these steps:
create a sub domain
install the demo package with sample data
export the #__content database table from the main website
replace the #__content table with the one you exported
Make sure your error reporting is on in your server's php.ini file so that you can see what errors php is giving i.e. error_reporting = E_ALL & ~E_DEPRECATED
In admin panel, can you see the articles in content menu?
If so, enter in each article and push the Save button.
After you save the article, it should appear again in frontpage (that worked for me).

Resources