test
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • earthson Friend
    #193007

    I am trying to make a change to the 404 error page on the Ja Brisk template. The template default 404 keeps popping up.

    I’ve created a new article, saved it as 404, and put in the uncategorized category.

    I created a hidden menu item for it, and copied the url.

    I opened up the error.php file in my template folder, but I cannot figure out where to insert the url.

    Here is the code on my error.php file. Can anyone help me out? Thanks!

    <?php/**
    * @package Joomla.Site
    * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
    * @license GNU General Public License version 2 or later; see LICENSE.txt
    */

    defined('_JEXEC') or die;
    if (!isset($this->error)) {
    $this->error = JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
    $this->debug = false;
    }
    //get language and direction
    $doc = JFactory::getDocument();
    $this->language = $doc->language;
    $this->direction = $doc->direction;
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
    <head>
    <title><?php echo $this->error->getCode(); ?> - <?php echo $this->title; ?></title>
    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/error.css" type="text/css" />
    <link href='http://fonts.googleapis.com/css?family=Handlee' rel='stylesheet' type='text/css'>
    </head>
    <body>
    <div class="error">
    <div id="outline">
    <div id="errorboxoutline">
    <h1><?php echo $this->error->getCode(); ?></h1>

    <div class="error-message"><?php echo $this->error->getMessage(); ?></div>

    <div id="errorboxbody">
    <?php echo JText::_('JERROR_LAYOUT_PLEASE_TRY_ONE_OF_THE_FOLLOWING_PAGES'); ?> <a href="<?php echo $this->baseurl; ?>/index.php" title="<?php echo JText::_('JERROR_LAYOUT_GO_TO_THE_HOME_PAGE'); ?>"><?php echo JText::_('JERROR_LAYOUT_HOME_PAGE'); ?></a>
    </div>

    </div>
    </div>
    </div>
    </body>
    </html>

    Ninja Lead Moderator
    #515592

    This way will help you to do that.

    Open templates/ja_brisk/error.php file

    from

    $doc = JFactory::getDocument();
    $this->language = $doc->language;
    $this->direction = $doc->direction;

    change

    $doc = JFactory::getDocument();
    $this->language = $doc->language;
    $this->direction = $doc->direction;
    header('Location: http://www.example.com/');exit;

    With http://www.example.com/ -> link to URL error 404 of your article

    earthson Friend
    #515651

    Hmmm – I could get it to redirect to the article, but it doesn’t show 404 as the page title, and the url doesn’t mention 404 either. I’m gonna have to play around some more.

    Ninja Lead Moderator
    #515667

    I’m not sure of what did to work on 404 error page. Please follow step by step to do it as my solution

    + Create an Uncategorized ‘404’ Article
    Create an ‘uncategorized’ article in Joomla! to serve as your 404 Page. Include some text such as Sorry, we could not find the page you were looking for… and if necessary, also any useful navigational links. For example, you may wish to add a link back to your site’s home page.

    + Create and copy a link to that new 404 Article.
    Create a menu item which links to the new 404 Article and ‘apply’ your changes. Then copy the URL information (index.php?optio…), set the menu item as ‘unpublished’ and close out of the menu editing page. You may want to paste the copied URL into Notepad or somewhere accessible for the time-being.

    + Modify error.php to Redirect 404 Errors to your 404 Article
    Edit templates/ja_brisk/error.php file as follows, adding the code below immediately under the ‘defined(‘_JEXEC’) or die;‘ line:

    Using this detection code instead:

    if (($this->error->getCode()) == '404') {
    header('Location: /index.php?option=com_content&view=article&id=75'); <- this is link to article of your site
    }

    earthson Friend
    #515799

    Hey NinjaLead,

    Thanks for the help – but, when I add that code I get this error:

    Parse error: syntax error, unexpected ‘<‘ in /home/xxx/public_html/folder/templates/ja_brisk/error.php on line 10[/B]

    Ninja Lead Moderator
    #515847

    Please pm me URL of your site, admin login and FTP account of your site and let me know URL of 404 Article need to redirect. I shall help you to check this problem on your site.

    earthson Friend
    #516181

    <em>@Ninja Lead 402488 wrote:</em><blockquote>Please pm me URL of your site, admin login and FTP account of your site and let me know URL of 404 Article need to redirect. I shall help you to check this problem on your site.</blockquote>

    I’ve PM’d you. Thanks 🙂

    Perhaps you can also help me out with the page title. The word “Articles” appears on the 404 url, even though I’ve disabled Titles and categories from appearing. And, the browser tab doesn’t say 404; it says my website name only. Odd?

    Ninja Lead Moderator
    #516224

    Yes, I helped you same as replied here here. Please check it on your site again. Let me know if it helps

    earthson Friend
    #516336

    Thanks Ninja Lead! I’m not sure what I did differently… but thanks for helping me out.

    Any chance you know how to get “404” or “Page Not Found” to show in the browser title, instead of “The Laughable News”? I can’t figure that one out either 🙁

    Ninja Lead Moderator
    #516415

    I have added this script into error.php file

    Open templates/ja_brisk/error.php file and see script


    if (($this->error->getCode()) == '404') {
    header('Location: /index.php?option=com_content&view=article&id=72');
    exit;
    }

    <blockquote>Any chance you know how to get “404” or “Page Not Found” to show in the browser title, instead of “The Laughable News”? I can’t figure that one out either :(</blockquote>

    You can do that this way and it will be showed article title into page title(404 page), see the screenshot


    1. show_title
    earthson Friend
    #516427

    Hey Ninja Lead,

    First, let me say thank you for sorting something out. I couldn’t, for the life of me, see where to edit that sort of info within articles. I thought it had changed in Joomla 3.0 and that all stuff like that was only edited in menu link options. I was pulling out my hair.

    After looking at your screenshot, I went back into the article, and I didn’t have the “Option” tab. Then I discovered it needed to be activated. Done! Now I can easily edit the page title.

    Unfortunately, this doesn’t solve the last thing I need to accomplish. What I want is for “404” or “Page Not Found” to show in the browser tab title. See screenshot. Thanks 🙂


    1. screenshot_browser
    Ninja Lead Moderator
    #516465

    @earthson: I understood your request, I would have helped you to change it directly from your site admin but the account you provided me is not permitted to see Option tabs in Articles.

    You need to use Super Administrator account and change the config in articles

Viewing 12 posts - 1 through 12 (of 12 total)

This topic contains 12 replies, has 2 voices, and was last updated by  Ninja Lead 10 years, 11 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum