Specify different site language for specific page with a plugin

I had a customer who wanted to specify a different site language for their events page made with Matukio. His main language was German and he had a single page, which had to be in English. I've wasted more hours than I'm comfortable to admit on this issue and that is why I thought that I'll share the solution with you, in case you need it.

If we were dealing with a standard multilingual site, the solution to this issue would be pretty straight forward. Define a new content language, enable the language filter plugin, create a menu item for our page and set the language to English. If we go this way we run into the problem that once a user lands on the English version of the page, all links on the site will get /en appended to them. But we don't want this. We want that the links stay as they are.

Continue reading
Rate this blog entry:
0
3827 Hits
0 Comments

Setting up PHP cronjobs (recurring tasks) for Joomla! extensions on Linux

Setting up PHP cronjobs (recurring tasks) for Joomla! extensions on Linux

With Matukio 4.3 we introduced some new time-dependent features, like automatic cancellation or confirmation of events X days before the start or automatic invoices X days after it. For these recurring tasks with PHP you need cronjobs. Cronjobs just execute a script or programm in a fixed rythm, in our case the Matukio cronjobs should be executed only once a day, but you can also set cronjobs to run every X minute or just once every week.

Please note: Windows offers something similar with Windows Task Scheduler, but in this post we are going to focus on Linux systems.

Depending on your environment there are different ways to setup cronjobs. In Joomla! installations cronjobs are normally stored in the /cli folder and they are mostly normal PHP files implementing the Joomla API.In this first part I am going to show you how to setup cronjobs in an Linux vServer / Rootserver environment. There are, depending on the extension, different approaches for that, we are going to focus on the direct PHP execution.Simple cronjob on a Linux server with direct PHP execution:Login into your server with SSH - you shouldn't execute PHP scripts as root, so maybe it's a good idea to create a new normal user or depending on directory permissions you would like to use the webserver user. After logging into the server type:crontab -eIf you want, you can export your favorite editor (if you haven't done so in for example your .bashrc already) with export EDITOR=nano first - if you aren't familiar with Linux command line editors, I suggest you try out Nano, which is a pretty easy and straight forward cli editor.After hitting enter the editor opens and you see your users crontab file - in this you create the recurring tasks.The syntax is pretty straight forward - your code begins after the comments (the lines with the # at the beginning).

Continue reading
Rate this blog entry:
2
17596 Hits
1 Comment

How to use Firebug to change the css of a Joomla extension

How to use Firebug to change the css of a Joomla extension

We are quite often asked how to change the style of an element in our Joomla extensions (for example changing the color in a heading etc.) or how to fix css problems in a custom Joomla! template. In this tutorial i am going to show you, how to easily find out these informations yourself, using the popular Firefox extension Firebug and how to apply them to your Joomla! template.Firebug is one of the must have add-ons for Firefox, not only helping you out with CSS, but also bringing various other useful development tools for debugging and monitoring HTML, CSS and JavaScript live in any web page.

So start by adding the addon to firefox by downloading it from the official addon page. After the installation you will notice a new icon in the firefox menu, if a webpage has any severe errors you will also see a red icon behind it (if script debugging is active).But in our tutorial we are going to use Firebug another way, let's say for example we want to change the heading color of the events in the Matukio eventlist overview: The color is, in this case, not directly set by the Joomla extension, but by your Joomla template. That does not change the procedure in any way. So we right click on one of the headings in Firefox and select "Inspect element with Firebug". After that firebug opens at the bottom of your browsers window. Don't get irritated by the immense output and options Firebug offers, we can already see the all informations we need.On the left side you see corresponding HTML code, on the right the CSS code which is affecting the layout of the element. We are searching for a color and you will notice that in our example it has none directly set, but only inherrited the color #333 from the body element (at least in our default Joomla template). But our h3 element isn't grey (#333) it is blue, that's the reason why this line is crossed out in Firebug. So where does the color come from? As you notice on the left side of Firebug currently the h3 (heading size 3) html element is selected (blue highlight), let's switch to the link element (<a>) by just clicking on it in Firebug. 

Continue reading
Rate this blog entry:
6
10152 Hits
0 Comments

Ajax requests on multilingual joomla websites

Today I've been working on making Hotspots multilingual ready. Since joomla 1.6 creating multilingual websites started to look like a piece of cake. There are several tutorials that explain how website administrators could do that: http://magazine.joomla.org/issues/issue-nov-2011/item/593-Build-a-Multilingual-Site-in-Joomla-1-7

And there is also a very good webinar that CloudAccess organised and recorded:http://www.youtube.com/watch?v=gnhVVtyejPg

Continue reading
Rate this blog entry:
4
44173 Hits
3 Comments

Working with Javascript in Joomla - Part 1

As Douglas Crockford puts it: “Javascript is the world’s most misunderstood language” . I think that in the Joomla universe this statement is 200% accurate. Most of the extension developers out there are good with PHP, but when it comes to javascript one wants to just find that snippet online, copy & paste it and forget about it - code quality here is not that important! And I say doh! It is important!

Joomla extensions are installed on 1000s of websites. But the thing is – users don’t install just 1 extension. They install a lot of them! Modules, plugins, and components – everything is thrown into the mix. And out of one small JS mess we get one big mess! Javascript is mixed with html, global variables are all over the place, there is no trace of modularity, no trace of good design patterns and it is just painful to watch. If you are lucky enough – your component will work and you won’t have to do any support, but as it happens most of the time – your extensions are not going to work because of other peoples copy and pasting!

Continue reading
Rate this blog entry:
3
25628 Hits
0 Comments

How to use JDate

Few days ago I decided to help Yves with a datetime bug in Matukio (dating back to its "Seminar" roots). Everything seemed to be straight forward. I've worked with JDate in the past and had some experience with timezones. So I took the challenge thinking that I'll spend 2h and everything would be fine. Well, as it often happens a 2h job turned to be a one and a half day job... (this could make a very good blog post about estimates, but I'll do that another time...)

Let us examine the problem at hand. User A fills out a form, which has a field that stores a date. The best thing to do when you store the date in the db is to convert it to UTC. Why to UTC? Well this way you can have always a starting point and when you present the output to the user you can add different timezones depending on the users position. The trick here is to convert the date back to UTC. Fortunately JDate can help us with that. If you look at the JDate class in libraries/joomla/utilities/date.php you will see that the constructor actually expects 2 parameters -> the date and the timezone. So when you save a date you would generally want to do something like this:

Continue reading
Rate this blog entry:
7
45617 Hits
3 Comments

Some awesome CSS 3 tips and tricks for your site - Part 1

With CSS 3 you can easily create some awesome effects, like nice borders, opacity-effects, roundings or beautiful text effects. How you could easily use it to improve your site i want to show in this tutorial series. In the first two tutorials we start with some basics and then move on to some more sophisticated things.

Remember CSS3 is not supported in all browsers, above all on old Internet Explorer Versions (prior IE 9) most effects will not work, but for the good part most modern mobile browser nd Chrome Safari (both Webkit) and Mozilla offer full support for CSS 3. A very nice overview table about CSS Browser support, you can find at http://www.normansblog.de/demos/browser-support-checklist-css3/.

Continue reading
Rate this blog entry:
3
31124 Hits
0 Comments

Transifex - the tutorial for Joomla developers

Transifex - the tutorial for Joomla developers

After 3 days of fight with Transifex my ordeal seems to be over! First a big thank you to Ratnadeep Debnath from transifex for working with me and fixing those bugs... And a big thank you for Peter van Westen for helping with my baby steps.

This tutorial is for Joomla developers that are considering the switch to transifex to manage their extension translations. Read on and I think that you will be up and running in no time.

Continue reading
Rate this blog entry:
8
46723 Hits
21 Comments