Skip to main content

Posts

Showing posts from July, 2012

Joomla / Eclipse: Use Eclipse to edit files

Even though I could use any Editor or Notepad, after some days of Joomla! I was yearning for some syntax highlighting and maybe even automatic code completion... I did some Java programming in the past, and I am really used to the Eclipse IDE. Eclipse IDE for JavaScript Web Developers seemed to be a good deal for what I was up to do, so I gave it a try.

I feel kind of stupid even posting about this, but upon starting up Eclipse, I started to wonder how I would do that - being that Eclipse works with projects, and I didn't want to put all of my components into an Eclipse workspace, and I didn't want to put up a subversioning system.

Turns out it is quite simple: Right-click somewhere in the package explorer,  select 'New', 'Project...'. In the dialog, open the folder 'General' and select 'Project'. Click 'Next'. For the name, I usually put the com_componentname / mod_modulename, as in my file system. But I don't think it matters. Then…

Joomla! 2.5: Component as Article

Can you put a component on a page together with other articles? Like, for example, to have a component and a blog layout on the "Home" page?

Yes, you can! There are some nice extensions that allow for this. I used the "Plugin Include Component" plugin, which is available on extensions.joomla.org. With this plugin, you simply create an article that contains a special tag, indicating the component to include.

Just like this:

Install the plugin and put the following code in whatever article you need it in (substitute 'componentName' and 'viewname' for your component's and view's name...).

{component url='index.php?option=com_componentName&view=viewname'}

Joomla! 2.5: Menu Items

Some time ago, I started to create my own components. Everything was working fine, but there was one thing that bugged me (even though it is not really necessary... it just looked strange):

When I create a link to my component, I always ended up with something like this in my menu manager:


Similar thing for the menu item type:


I felt like I somehow missed something, but the tutorials did not say anything about it. After playing around for a little while, I found out that the solution actually is pretty simple: The site > views > viewname > tmpl > default.xml file specifies these texts. Joomla! will look for these keys in the language files. Thus, you just need to add some entries to the language files and voila - everything looks nice and clean, just like this:


Step-By-Step:

Let's assume you already created the default.xml file with contents similar to these:

<?xml version="1.0" encoding="utf-8"?>
<metadata>
    <layout title="COM_…