Hosting Gratis
Home » , » membuat custom halaman eror 404 Joomla 2.5

membuat custom halaman eror 404 Joomla 2.5

advertisment


membuat custom halaman eror 404 Joomla 2.5

  1. On your Joomla 2.5 control panel, add New Article with a 404 title under Uncategorised category.
  2. Add New Menu Item with a 404 Error Page title then link your new article but make the Status Unpublished.
    Click Save & Close.
  3. Edit the newly created menu item 404 Error Page. Copy the Link content (e.g. index.php?option=com_content&view=article&id=121).
  4. Go to your joomla folder and copy error.php from templates/system/ folder to your default template folder (e.g.templates/itropicstemplate/).
  5. Open the newly copied error.php and add this line after the defined('_JEXEC') or die; line.
    if (($this->error->getCode()) == '404') {
    header('Location: index.php?option=com_content&view=article&id=121');
    exit;
    }
    So, your error.php file should look like this.
  6. Replace index.php?option=com_content&view=article&id=121 with your link content as per step # 3.
  7. Visit your website and navigate to a non-existing page to test your custom 404 error page.

ALTERNATIVE WAY

  1. On your default template folder (e.g. templates/itropicstemplate), duplicate your index.php and rename it toerror.php
  2. Open your error.php file and add the title line on your head part.
    <head>
    ....
    <title><?php echo $this->error->getCode(); ?> - <?php echo $this->title; ?></title>
    ....
    </head>
  3. Add the jimport line after the line <body>. So it will look similar to this:
    <body>
    <?php jimport( 'joomla.application.module.helper' ); ?>
    ...
    ...
    </body>
  4. On your main content where you normally place the syntax <jdoc:include type="component" />, replace that with your 404 error message like the one below.
    <div style="width:100%;">
       <h2>Oops...</h2>
      <p>Sorry, we could not find the page you were looking for...</p>
      <p>&nbsp;</p>
      <p><a href="http://www.itropics.net">Go back to home page</a></p>
    </div>
  5. Now your menu and other modules will not show up on your 404 Error page. In this case, we need to use theJModuleHelper::getModulesyntax.

    Let say, I want to show the menu module.

    Change:
    <jdoc:include type="modules" name="menu" />
    To:
    <?php $module = JModuleHelper::getModule( 'menu' , 'Main Menu' );
    $attribs['style'] = 'xhtml';
    echo JModuleHelper::renderModule( $module, $attribs);    ?>


    getModule syntax is getModule( $name, $title ). More info about getModule can be found onhttp://docs.joomla.org/JModuleHelper/getModule.

    If you want to display a Custom HTML module, $name is custom and $title is your title, so mine would be Footer - Column 1, like:
    <?php
    $module = JModuleHelper::getModule( 'custom' , 'Footer - Column 1' );
    echo JModuleHelper::renderModule( $module);
    ?>

    If you want to display the DisplayNews module, $name is dn.
    If you want to display the Search module$name is search.

    membuat custom halaman eror 404 Joomla 2.5


advertisment
Jika Sudah Membaca di KLIK yaa :
Anda sedang membaca Artikel tentang membuat custom halaman eror 404 Joomla 2.5, dan anda bisa menemukan artikel membuat custom halaman eror 404 Joomla 2.5 ini dengan url http://anbu-files.blogspot.com/2012/08/membuat-custom-halaman-eror-404-joomla.html. jika Anda menyukai Artikel di blog ini, silahkan masukkan email Anda dibawah ini untuk berlangganan gratis via email, dengan begitu Anda akan mendapat kiriman artikel baru.

1 komentar:

  1. Hi there to all, it's actually a nice for me
    to go to see this web site, it includes important Information.

    BalasHapus

 
Copyright © 2013. Joomla Tutorial, Blogger Tutorial, Wordpress Tutorial, Info and Trick Adsense - All Rights Reserved
Berita Unik dan Update BING 2013 | Template by SHARE4RT | Proudly powered by Blogger