membuat custom halaman eror 404 Joomla 2.5

advertisment
Selamat datang di blog Panduan Belajar Website Lengkap . Berikut ini adalah update artikel terbaru mengenai informasi tentang membuat custom halaman eror 404 Joomla 2.5 silahkan untuk membaca dengan seksama dan mohon untuk disikapi dengan bijaksana mengenai informasi di artikel membuat custom halaman eror 404 Joomla 2.5 , semoga artikel tentang membuat custom halaman eror 404 Joomla 2.5 dapat menambah wawasan serta info yang anda cari atau butuhkan.

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
Terima Kasih Atas Kunjungan Anda | Semoga informasi dari Blog ini dapat bermanfaat bagi Anda
Judul: membuat custom halaman eror 404 Joomla 2.5
Ditulis Oleh ndesain.web.id
Tulisan ini memberikan informasi yang bermanfaat untuk anda? Jika mengutip harap berikan link yang menuju ke artikel ini ataupun langsung ke artikel sumber membuat custom halaman eror 404 Joomla 2.5. Sebarkanlah jika artikel ini bermanfaat menggunakan link share sosial media di bawah. Terima kasih atas kunjungannya, jangan lupa untuk membaca related post menarik lainnya

0 komentar:

Posting Komentar