Monday, 26 July 2021 09:47

XML sitemap is rendering as HTML

I'm using Jsitemap and SH404sef, and found that the XML sitemap was rendering as HTML rather than XML.
To fix this, go to the configuration options in SH404SEF, General > Advanced tabs and ensure that the setting '301 redirects from non-SEF to SEF' in the configuration of sh404sef is not enabled.



If you still experience issues after changing this setting you can also change the sh404sef settings: configurationby component and choose 'Leave as non-sef' or 'Use Joomla router' for Jmap.

Additionally, within the Jsitemap settings Configuration > Advanced settings it's important to ensure that the following parameter is disabled and set to 'No' as by default in order to always use native raw links for each sitemap:

sitemap links rewriting

Published in Blog

Set the Join table #1 for the where condition filter 'id' = your category ID that is 1 category that should be included


Published in Blog

Here's a handy feature of JCE to make it display the name of each HTML element and container as they are used in the text editor.

  1. Go to Components > JCE Editor > Profiles
  2. Edit the enabled profile
  3. Click the ‘plugin parameters’ tab, then scroll down to VisualBlocks
  4. Enable that and you’re good to go
Published in Blog
Thursday, 28 February 2019 06:13

Get the URL of a K2 extra field image

K2 extra fields can be a royal pain sometimes. They are not nearly as flexible as they should be. For instance, using the image extra field spits renders the image inside it's <img src /> tags. But what if you just want the URL of the image? Perhaps you need the image URL to use inside a CSS background image. Here's how:

Note that the alias of the extra field in my example is myImage. Change this to match your own custom field alias.
Also note that I am using this code inside a mod_k2_content module.

$fetchSrc1 = explode('src="', $item->extraFields->myImage->value);
$fetchSrc2 = explode('"', $fetchSrc1[1]);

<?php echo $fetchSrc2[0]; ?>

For using on K2 item pages, replace the first line with the following:

= explode('src="', $this->item->extraFields->myImage->value);

Published in Blog

Sometimes you need to know the category of the current K2 item, but reneder this information outside of the K2 template files. To check anything K2 outside of the K2 container, the code below is a good starting point.
By expanding this code a bit, you can check for all sorts of things, always from outside of the K2 container. For instance, I can use the following inside the <head> tags to trigger something specific to an item.

// Check if the item belongs to a specific category

// Gets component, view, and ID from the non-SEF URL
$whatComp = JFactory::getApplication()->input->get('option');
$whatView = JFactory::getApplication()->input->get('view');
$whatId = JFactory::getApplication()->input->get('id');
// Check if you are on K2 and viewing an item
if($whatComp == 'com_k2' && $whatView == "item") {
// Check the database for the category ID of the current K2 item
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->where($db->quoteName('id')." = ".$db->quote($whatId));
$myCatID = $db->loadResult();
// The number to be compared below is the ID of the category

if($myCatID == '17') {
// do something


Published in Blog

$parent = JTable::getInstance('K2Category', 'Table');
echo $parent->name;

Published in Blog
Tuesday, 30 October 2018 08:17

Disable Admin tools via FTP

Using FTP to regain access to your site's administrator, The failsafe way to regain access to your site's administrator backend is using an FTP application or your hosting control panel's File Manager to rename a file.

Go inside the plugins/system/admintools/admintools directory on your site (on older versions of Admin Tools: plugins/system/admintools). You will see a file named main.php. Rename it to main-disable.php. This will turn disable the Web Application Firewall from executing and you can access your site's back-end again.

After you have fixed the cause of your issue remember to rename main-disable.php back to main.php, otherwise your site will remain unprotected!


Published in Blog
Sunday, 10 December 2017 01:05

Remove spaces from image file names

I've been working on a website that uses Mijoshop (the Joomla e-Commerce and shopping cart component built using Opencart). Problems occurred when I wanted to use product images as CSS background images, rather than HTML images. The client had uploaded a bunch of images that contained spaces within the file names, making them unsuitable to be used in the CSS background-image property (which just left empty white spaces where the images should have appeared(. There were so many that it just wasn't feasable to rename them manually, so I needed to figure out an automated solution, which became a three step process:

  1. Install an Opencart script that future proofed the problem of file names containing images from this point on.
  2. Renaming the existing images already used on the server
  3. Modifying the SQL tables to match the newly renamed files names

Step 1 - Future proof Mijo Shop

I found this opencart ocmod script that removes spaces from any images uploaded. It worked great and was easy to install directly using the extensions installer from Mijoshop main menu. The file can be found here.

Whilst this ensured that any images uploaded from this point on wouldn't have any spaces withn the filenames, this script didn't fix the problem for any images already uploaded into the Opencart catalog. The next step in this solution addresed that problem.


Step 2 - rename the existing files

I found a handy program called Rename-it! which made easy work of btach removing all spaces in the exisiting files. I tested this locally on desktop rather than applying it directly to the server. Rename-It! is free, easy to use, and also didn't install any crappy third party bloat software. Too easy!


Step 3 - Match the database filenames with existing files

The tables in the website database need to match the newly renamed files. We can do this with a simple SQL find and replace script that removes the spaces in the filenames. make sure to change the table name and column name to match those used by your website

UPDATE table_name
SET image = REPLACE(column_name, ' ', '');

Published in Blog
Wednesday, 22 November 2017 02:23

Adding extra fields to the Joomla contact form

The default Joomla contact form component does allow us to modify it slightly and add new fields to the contact form. New fields are contained within a field group. Follow the steps below and view the video tutorial for further explanation on these concepts.

  • Go to "Components" and "Contacts".
  • Click "Field Groups" in the left-hand sidebar.
  • This is the important new task: choose "Mail" from the dropdown menu. This means your fields will be attached to contact forms that users can rely on to send email. If we choose "Contact" or "Category", our fields will only be available to site administrators. If you choose "Contact", this will be similar to the Address, City or Suburb, etc fields we saw above.

Adding extra fields to the Joomla contact form  1

  • Click "New".
  • Title: Extra Contact Details
  • Save the field group and make sure your next screen looks like this:

Adding extra fields to the Joomla contact form   2

  • Click "Fields" in the left-hand sidebar.
  • Again, choose "Mail" in the dropdown menu:

Adding extra fields to the Joomla contact form   3

  • Click "New".
  • Title: What is Your Question About?
  • Type: Checkboxes

Adding extra fields to the Joomla contact form   4

  • Field Group: Extra Contact Details
  • Checkbox Values: Enter topics that people might be contacting you about.

Adding extra fields to the Joomla contact form   5

  • Click the "Permissions" tab.
  • Set "Edit Custom Field Value" to "Allowed". This will allow anyone to enter data into this field.

Adding extra fields to the Joomla contact form   6

  • Visit the front of your site and your contact form will now have a custom field:

Adding extra fields to the Joomla contact form   7

Published in Blog
Wednesday, 22 November 2017 00:42

Embedding videos into a Gantry particle position

This tutorial will show you how to embed a video into a Gantry particle position on a Joomla website. This tutorial does require the website to have installed the Joomla Works All Videos plugin.

Whilst in this tutorial I use a video that is hosted on Youtube, the same concepts can be slightly modified for any videos that are hosted on your own web server. For a deeper explanation of the differences I suggest watching my previous tutorial Embedding locally hosted videos on a Joomla website.

Published in Blog
Page 1 of 3