Thursday, June 15, 2017

How to redirect 404 Pages to your Articles in Joomla


Create Custom 404 Pages in Joomla

We're going to create an article, add a menu link and then add a little code to a file in your template folder.

Step 1: Create an article

media_1374034818704.png
The first step in creating a custom 404 page is to create a new article.
  • Title: Create something that is specific to Error 404 since it may be displayed as your browsers title bar.
  • Alias: Type in a simple alias, such as 404.
  • Category: You can use Uncategorised or create another category.
  • Article Text: Add your 404 image or text, or design it however you'd like. In this example, I made my own funny 404 image.

Step 2: Edit Metadata Options

media_1374035630923.png
  • On the same article, look at the right column and click on the "Metadata Options" tab.
  • Select "No index, no follow" to prevent this particular page to be indexed in search engines.
  • Save and Close.

Step 3: Create a Hidden Menu

media_1374035895974.png
You can view our tutorial on how to create a Hidden menu here.
  • Menu Item Type - Select your Error 404 Page article.
  • Menu Title - Anything you'd like, such as Error 404 Page.
  • Alias - Type in a simple alias, such as 404.
Make sure this menu is not published in a module position so it is not displayed.

Step 3: Copy the Link

media_1374037469200.png
Copy the URL from your menu and store it on a notepad since you will be using this URL in your error.php file.

Step 4: Edit the error.php File

media_1374039749187.png
Find your error.php file.Usually it is located in "templates/YourTemplate/system/error.php" or in "templates/YourTemplate/error.php".
If you don't have an error.php file, create it in this folder: templates/YourTemplate/error.php.
Please make sure that you have this security code at the top of the file:
 defined( '_JEXEC' ) or die( 'Restricted access');
Now we need our 404 page code.
For Joomla 1.5 use this code:
 if ($this->error->code == '404') { header('Location: /theURLtoYour404Page'); exit; }
For Joomla 2.5 and 3.x use this code:
 if ($this->error->getCode() == '404') { header('Location: /theURLtoYour404Page'); exit; } 

Step 5: Test Your 404

Type in a URL such as yoursite.com/blahblahblah to be redirected to your custom 404 page.

how to change background color of single menu item



If your template does not include a Custom CSS option, try adding the CSS to the end of your templates CSS file.
  1. Within your Joomla administration navigate to the menu which contains the menu item you wish to style (Menus -> [YourMenu]).

  2. Joomla assigns a unique ID to each menu item. We are going to use this ID when styling the item. Under the ID column of your menu items, take note of the ID for the menu item you wish to style (Eg. 507).

    menu item ID
  3. Using your menu item ID we will add some CSS to your template using the 'Custom CSS' field of your templates parameters. Navigate to Extensions -> Templates and click in to your template settings. Select the 'Custom CSS' tab and add the following CSS to the field provided, editing the ID to match that of your menu item and the color to your own taste.

    .item-507, .item-507 > a { color: #D14233 !important; }
     
  4. Hit 'Save & Close' to apply your custom CSS.

Monday, February 13, 2017

Warning You Do Not Have Access to the Administrator Section of This Site


  • Step 1: Check if the user is really an administrator: In many cases, this error happens when the person is trying to login with a user who’s not an administrator (usually this happens when the person has two users on the website, and he’s logging in with the wrong user) or who’s no longer an administrator (someone might have revoked administrative access for that user). Checking if the user is an administrator is easy – all you need to do is to check if the id of the user is assigned to the right group in the table jos_user_usergroup_map (replace jos with your table prefix) usually it is 8   If all is OK (the user is assigned to the right group) then we move to the next step… (If not then we fix the problem)
  • Step 2: Check if the ACL tables are not corrupt: This is where it gets tricky since Joomla’s ACL tables are not that easy to understand. However, if the login problem is because of ACL corruption, then in 99% of the cases the error lies somewhere in the jos_viewlevels and/or the jos_usergroups tables. We suggest that you look at a clean Joomla database and compare the two tables of that database with those in your website’s database. If the ACL tables are corrupt, then we manually fix them (fixing these tables should only be done by an expert) – if not, then (you’ve guessed it!) we move to the next step.
  • Step 3: Check the jos_assets table: If all else fails, then (sadly) the problem almost certainly lies in the jos_assets table (which is, by far, the scariest table in Joomla – because a simple mistake in that table can cause a total collapse of the website). The two most common causes in the jos_assets table that might lead to this problem are:
    1. Missing entry for the com_admin row.
    2. Wrong rules field for the com_admin row. The rules field for that row should just contain “{}”. (two curly brackets)

Sunday, January 15, 2017

Save Failed with the Following Error: Invalid Parent ID

When I have seen first time this error on Joomla 1.6 while tried to save a new article in Article Manager I was lost:

Save Failed with the Following Error: Invalid Parent ID
I was diggin' around to see what can be wrong, and the final clue leading me to the solution where come from a phpMyAdmin checkup. Weird thing was that the article has been saved, but I found an unexpected value in the article's database record: the article wasn't assigned to any category ID and found a value which I wasn't knowing back then what a heck is for: a column called asset_id with value set to zero.

And this clue has been leading me to the solution (BTW, first step with rebuilding the menu might be unnecessary, but I decided to leave it there - because can't harm, but might fix similar errors in menu system you are not aware of - yet):
  • Go to the Menu Manager – Click on Menus, Menu Manager, Click on the ‘Rebuild’ button
  • You will see a message that says:
    Successfully rebuilt
  • Go to the Category Manager – Click on Content, Category Manager, Click on the ‘Rebuild’ button.
  • You will see a message that says:
    Categories tree data successfully rebuilt.
  • Edit all your parent categories and save them.
  • Edit all your sub-categories and save them.
  • Go back to the Article Manager, edit all the articles that were created with the ‘Invalid Parent ID” error message and save them again.
After refreshing your menus, categories you should not have any problems creating new articles anymore. As to the existing articles that had asset_id = 0, those asset_id’s will get populated after you open and save the articles.

As you might guessed allready, the error was generated by the fact that the category tree structure was messed up for some reason.

If you fail then watch video for more solutions 







Friday, November 13, 2015

Get it right

This blog solely is for Joomla professionals.  

Being a Joomla professional sometimes we do get into trouble solving a problem while creating a Joomla website.

Many errors suddenly creep up and you may end up searching for solutions in Joomla forum and not find solution immediately.  There could be some simple works, changes in your Joomla website that you need to do.  Like for example changing the copyright field in the footer.   Not everytime you will like to visit the Joomla forum for that.  Not always you will find instant Joomla solutions at Joomla forum.

Here at this blog an effort is made to solve some of your Joomla problems that you encounter while working in Joomla.

The advantage is that you will find the solution here always and instantly just by seeing the title of post. 

It will be fast and quick.