Withdrawal of Support for Joomla 2.5

With the removal of official support for Joomla 2.5 by the Joomla Project, we regret we are no longer able to provide general support for our Joomla components on this version.  Instead our support will concentrate upon the latest Joomla 3.x versions, currently 3.4.

Should you experience with our extensions upon Joomla 2.5 we will try to help and advice and possibly investigate but no new features or enhancements will be developed.

We recommend our customers migrate to the latest officially supported Joomla version as soon as it is possible.

652 Hits

Making a component truly Multilingual (3)

Following on from our earlier post about item associations. we next turn our attention to look at the front end.  This tends to be more complex since it is here that we are actually using the associations to impact the front end displays.  To expand upon this, when a user chooses to display the categories in for example ‘German’ it is the ‘de-DE’ categories that should be displayed, along with the appropriate ‘de-DE’ translated text.  Likewise if they then choose to display ‘English’ the ‘en-GB’ categories are displayed along with the English text.  It is also reasonable to expect that any categories that are marked as ‘All’ languages would also be displayed in each case.

The specific ‘category items’ to be displayed for a chosen language would be the ‘specific’ language items, together with the items marked as ‘All’' languages’. The question of what about the un-translated items which are not associated with a ‘specific language version has also to be considered.  This is best explained by considering a specific situation.  Assume that we have our ‘Rialto’ component available with a English (en-GB) and a German (de-DE) translation.  All of the categories are established with the correct associations, however they may well be a number of different ‘entries’ that are present in only one specific language, which would not then have any associational entries in the other language.  In our Rialto example, the entries are ‘classified advertisements’, it is not unreasonable to assume that an advert for an item to buy/sell in German, may not be of interest to an English person, and that might therefore not be a translated version of the advert created. The question is then does one display the ‘German’ item to an English viewer?

We are assuming here that the ‘English’ viewer is displaying the site in the English language, and that a ‘German’ viewer is displaying the site in the ‘German’ language.

Taking this one stage further, assume that we wish to determine the total number of entries in a specific category. On the surface this sounds simple, but once we are multilingual we have  a few additional complications. First we have the number of entries for which there is a single language specified (or all) for each of the different associated categories. This means that all the un-associated de-DE German entries in a category are counted together with the number of un-associated entries in the equivalent en-GB category are to be counted. Then we have the entries where we have an entry associated, in this case we only wish to count the entry once, even though there may be a de-DE and a en-GB translation they are effectively the same entry for counting purposes. This makes getting the total number of entries complex in terms of the SQL statement that is required, especially given the underlying table structure, involving sub-queries ( or numerous joins).

The approach we have taken is that we would only, by default display specific items in the selected ‘viewing’ language (plus items marked as being ‘all languages’).  Switching the site language to one of the other possibilities would (probably) display different entries. i.e. This marked as ‘all’ and those available in the current selected language whether associated or not).

This might seem complex but should provide the site visitor with the entries in the chosen site language and those marked as visible for ‘all’ languages.

There is also the question of which entries are displayed in the ‘module’ which displays the latest ‘n’ (where ‘n’ is the number) of entries recently opened/created.  The entries displayed are interpreted as being those created/opened in the displayed site language and those created/opened as being ‘all’ languages.

Similar to the changes for the back end we have to modify some of our code but the changes are different, mainly because it is only really the actual items created/maintained upon the front end that need the most work.  We require changes to any ‘drop down’ selection boxes so that the displayed options are in the chosen site display language, which means changes to the ‘helper’ files. Other changes relate to the displays which are themselves more involved than for the back end, since we can create entries on the front end and (presumably) also need to probably create entry associations as well. This last task is something that, from our study code reading is not something that Joomla com_content does currently so may well be something that we ourselves put on the back burner, leaving the back end to create the associations between entries. Not ideal perhaps but it seems to be something that Joomla multilingual sites are currently having to wrestle with already, so will be familiar to them.

To be continued…

612 Hits

Making a component truly Multilingual (2)

In an earlier post we mentioned the topic of associations. In Joomla terms associations are effectively links between equivalent items that are in different languages. In our component we also wish to allow associations so there are a few changes we need to implement for this as well. There are no table changes required since we will be making use of the supplied Joomla associations table.  This table is composed of three columns, the first being an id column that is the value of the specific item being referenced. In our case it is the id of the category or entry. It is worth mentioning that within the Joomla associations table the id column is NOT a primary key. The second column is a context value, which is typically composed of the name of the component followed by the specific component type separated by a full stop. i.e. ‘com_rialto.category’ or ‘com_rialto.entry’.  The third and final column is a hash (md5) key. This key is what is used to ‘associate’ the various parts together. So as an example two categories associated together would have the same ‘hash key’.

Associations – Back End

The setting up of associations is something that seems to be restricted mainly to the back end so it is these changes that we will look at first.

The following changes are required:

  • Modify the views such that if associations are enabled they are displayed as required.
  • Modify the model save method so that upon the item being saved the existing associations are removed and ‘new’ associations created.
  • Modify the model ‘delete’ method so that when a item is deleted any existing associations are removed. If the component is making use of the ‘trash’, i.e. when an item is deleted it is not actually removed, just relocated to a ‘trash’ status for removed when the ‘trash is emptied’ this also has to be allowed for in our code.   [Note that we found a problem in this area, in that the code we were following for the Joomla content component, there was no appropriate code to remove associations in the delete method. We think this is a definite Joomla bug, unless we have missed something we do not understand.]
  • Modify the model ‘get’ methods so that the associations for the specific item are picked up correctly. 

The change for the views is slightly more complex than it might initially seem, since there has to be incorporated a means for the selection of ‘other’ items for the associations to be made. This is achieved by making use of slightly modified modal views which are displayed to enable the selection to be made.  We say ‘modified’ since for a selection criteria one does not necessarily need to display all of the item details, only sufficient to enable a clear distinction to be made to enable the correct item selection to be made.  The ‘code’ we were following/studying also permitted editing of the item from these modal views, however we question the logic as to why one would wish or want to provide additional editing at this point. The coding is not difficult but just, to our mind, seems unnecessary.

This does effectively complete all of the back end changes with very little pain being encountered on the way.

The question of how the ‘entries’ are displayed using the associations is something that is more specific to the front end. In the back end we tend to concentrate upon the maintenance aspect of the various associations so the coding in the models is virtually unchanged as we wish to see ‘all’ of the entries and categories, irrespective of what ever language they may be written in. This is something we will consider in the next post in the series as there are a number of situations to the covered.

To be continued…..

615 Hits

Joomla Audit 1.1.0 released.

auditWe are pleased to announce the availability of Macrotone Joomla Audit release 1.1.0 for Joomla 3.4

This minor release corrects a problem discovered in the earlier release 1.0.2 on some tables. It also introduces a few new features, the most notable of which are the ability to 'purge' out all change history records with a single click, and also the ability to download the change records as a CSV or zipped file, for later post processing if required.

This version ONLY runs on Joomla 3.4 and above.

 See the changelog for details of all of the changes.

 The update is available in the download area.

We have also repacked the older 1.0.2 release with the updated helper file and released it as version 1.0.3 for Joomla versions 2.5 and Joomla 3.3 and earlier. This is unsupported but fixes a known problem with the 1.0.2 release.

676 Hits

PHP Storm 9 available

We have been using the JetBrains PhpStorm application in our development for some years and knowing some of our readers also are interested we note that PhpStorm 9 is now finally released!

PhpStorm 9, the next big release of our IDE for PHP and web development, is already here. Make faster progress with PhpStorm 9’s refined editing and debugging experience, deeper code understanding, advanced productivity boosts, and complete support for remote development:

PHP Language & Editing Experience: Includes postfix code completion for PHP, partial PHP 7 support, advanced code understanding (Introduce parameter refactoring, advanced PHP type inference, support for persistent language injections, and new inspections and intentions), and other enhancements.

New Debugging Experience: Inline debugger for PHP and debugging workflow enhancements (php.ini can be opened from settings, and debugger config validation has been enhanced).

Remote Development: Remote edit, PHP Code Sniffer and Mess Detector via remote PHP interpreters.

Many improvements related to frameworks and tools.

A range of new and updated third-party plugins available in the PhpStorm plugin repository.

842 Hits

IP Mapping 1.3.2 released

location-48IP Mapping release 1.3.2 available.

The Joomla component came from a requirement to display IP addresses of site visitors upon Google maps.
This release required a Joomla version 3.3 or above to function. Earlier versions are not supported. The release adds an option to use HTML5 geo-location determination to store the visitors location data. The browser itself, if it supports HTML5 geo-location controls the whether the user permits or declines to share their location data. If the user declines then the normal IP location determination mechanism is used.

This minor update corrects a few minor problems with the earlier 1.3.1 release.  Tested upon Joomla 3.4.3.

See the changelog for details.

The release is available in the usual download location on our site.

607 Hits

Making a component truly Multilingual (1)

One of the first requests we received for our Issue Tracker component after its initial release was to make if ‘Multilingual’.  At the time we were rather busy but recorded the request with the intent to implement it later when circumstances permitted.. We recently decided to look at the changes involved in more detail but decided to look at our Rialto component, which is not so complex and would (should) be easier to modify.

It is important to clarify exactly what is meant by a component being ‘Multilingual’.  It is one thing to have language translations available for a component that can be loaded upon a site to permit the component to display the inbuilt ‘text strings;’ in the native language of the site, but this does not in itself make the component ‘Multilingual’.  Perhaps the best definition is that a site can be considered ‘Multilingual’ if it is possible to support more than one language such that one can switch from one to another via a single mouse click.  Items like site categories, menu items, and articles etc. would at the same time change to be in the selected language. A component would be ‘Multilingual’ if it can itself support such transitions. The classic Joomla component that does this is of course the ‘com_content’ component.

There is one other aspect that needs to be mentioned and this is the matter of ‘Associations’.  Joomla permits an article, or a category (amongst other things) to have an assigned language.  If one were to translate an article into another language then the site would have two (or more) identical articles each the same apart from the specific language. Joomla then permits one to ‘associate’ the one article with the other, such that the ‘seamless’ change on changing the language in use is switched is achieved.

Of course one does not necessarily have to translate all articles, and it is possible to define a default language (indicated by a ‘*’) which is display which ever site language is in use.

Our Rialto component, which is a Classified Advertisement component, is a situation where it is expected that a ‘Multilingual’ site would possibly have categories in different languages, which are probably ‘associated’ but that the specific adverts themselves (known as entries) are unlikely to be present in anything other than the one language. This does not mean that advert entries might not be in multiple languages just that the situation is not likely to be so common.

We shall describe some of the changes that were required to achieve what we desired, but given the number of changes required will split it into several parts. We will endeavour to avoid ‘too’ much specific code, and instead concentrate on the areas where we made our changes. We will also describe a few ‘opportunities’ for enhancement that we discovered whilst implementing the changes.

Just before we start into the detail it is worth mentioning that there is a component name ‘JAMultiLingual’ from Joomla Arts that can be used to set up a Joomla site for ‘Multilingual’ and certainly aids in getting started into Joomla Multilingual. It is not the only possibility but one which we have used and found very well constructed.

Language Field

The first step is to add the additional ‘language’ field to the database tables that we wish to have language contained within.

ALTER TABLE `#__rialto_categories` ADD `language` CHAR(7) NOT NULL COMMENT 'Language code';

Obviously we require the same column present upon all tables not just the one indicated. We also have to consider whether to apply a default language setting, possibly ‘All’ (*) for any existing entries that may be present in the database.

Having made the table change we then have to make the following code changes:

  • Change the component list and single item views so that the field is displayed.
  • Modify the Model ‘getItem’ (getItems) methods to return the additional language field to the views
  • Modify the Model Item ‘Save’ method so that the language field is updated when an item is updated or created. Ensure that a suitable default is applied if required
  • Note that one has to allow for the option that the component is being used upon non-multilingual sites and thus ensure that all situations are allowed for.  There are some standard Joomla language routines that enable one to test whether languages are installed (Method JLanguageMultilang::isEnabled() ), which aid in the coding.

These changes are ‘required’ for the back end, but may also be required in the front end if appropriate. It is not common to permit the creation (or editing) of Joomla categories in the front end, but it one permits the creation of ‘entries’ (articles)  in the front end, which is true for the Rialto component then we have to modify these as well. It is reasonable to assume that in the front end of the site, if a person is creating a new ‘entry’ that the language currently displayed on the site is the one in which they are entering the entry details. Otherwise one has to provide the user with the option of specifying the language they are using. 

These changes are required for all tables.

To be continued…..

665 Hits

Displaced anchor links when used with a fixed page header

We recently introduced a couple of new articles upon our site which made use of internal referenced anchor points to make navigation a little easier. We immediately saw a small problem, in that although the anchors worked and directed the viewer to the relevant part of the article, the positioning was below the required anchor point, so that the header and part of the text was obscured. This was caused by our using a fixed header on each page.

We pondered on the problem for a while and then found this interesting article on the web which described a virtually identical problem and a possible solution.

For those who only want the solution and in case the original article is ever removed, we reproduce our modified version of the solution below.

First, I moved the id’s of each h3 section to a new element: (a span in this case)

<span class="anchor" id="section1">span>

The new elements were added right above each header section and would serve as the new anchor point. Whilst empty elements on a page are not perhaps the best solution, in this situation is certainly solves the issue.

Once the new elements were in place, a bit of CSS was added to the template custom css:

  display: block;
  height: 90px; /*same height as header*/
  margin-top: -90px; /*same height as header*/
  visibility: hidden;

It also works well with the responsive template and changing browser window sizing.

617 Hits

IP Mapping, clustering, refresh – performance impacts

ipmappingWe mentioned the other day about using HTML5 to determine a site visitors location and using it to be displayed upon a Google map. We are here looking at the various options that need to be considered when setting the parameters for the best ‘site impression’.  I have deliberately used the term ‘impression’ because most of the ‘work’ is actually performed by Javascript in the users browser. Each user will most likely be using a different machine, i.e. Desktop, laptop, tablet, smartphone etc., not to mention the different processors included in each type, and all these will different performance characteristics.  This each user’s impression of ‘how fast’ a site actually is, will be different, and this is without considering the impact of any network performance in a) obtaining the source data from the web site and b) the transfer of data to/from the Google mapping servers.

Continue reading
670 Hits

Experiences with HTML5 mapping

ipmappingWe have recently been updating our IP Mapping Joomla component to handle HTML5 geolocation detection and thought this may be of interest to others.

IP Mapping was originally designed with the aim of displaying IP addresses upon Google Maps and experience has shown that although it works well it is very reliant upon the accuracy of the data held by the various database and communication suppliers. The various supplied of the IP to location mapping vary considerably in the accuracy of the location information. We ourselves have been ‘located’ as being several hundred miles away from where we were physically located, depending upon which IP-location provider we were using and when we were determining the location. Whilst this may be adequate for some, for others it is a little bit hit and miss. I am thinking here of a ‘local’ village or town intending to serve the local neighbourhood, who desire to know how widespread their visitors are.

Continue reading
713 Hits
Go To Top

The Macrotone Consulting Web site would like to use cookies to store information on your computer, to improve our website. Cookies used for the essential operation of the site have already been set. To find out more about the cookies we use and how to delete them, see our Privacy Policy.

I accept cookies from this site.