Webocreation

Wednesday, May 11, 2011

Introduction to the page refreshing and redirecting the page to another page within the specified time period




Introduction to the page refreshing and redirecting the page to another page within the specified time period.


<META HTTP-EQUIV="refresh" CONTENT="seconds;URL=the-other-url">


Examples of HTML Redirects

<META HTTP-EQUIV="refresh" CONTENT="5;URL=the-other-page.html">
The redirecting page will be displayed during 5 seconds. After this 5 seconds delay,

it will be replaced by “the-other-page.html”.

<META HTTP-EQUIV="refresh" CONTENT="12;URL=http://www.internetofficer.com/">
The redirecting page will be displayed during 12 seconds. After this 12 seconds

delay, it will be replaced by the home page of this site.

<META HTTP-EQUIV="refresh" CONTENT="0;URL=another-page.html">
The redirecting page will be displayed and immediately replaced by

“another-page.html”. With this zero-delay, many users will not even notice the presence of the redirecting page.


How we can redirect the page in the opencart when error page is found?

On the controller where the following line exist:

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
    $this->template = $this->config->get('config_template') . '/template/error/not_found.tpl';
} else {
    $this->template = 'default/template/error/not_found.tpl';
}

insert this
$this->data['metatoredirect']="<META HTTP-EQUIV=Refresh CONTENT=\"10;URL=index.php?route=product/productlist/\">";

=========================
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
    $this->data['metatoredirect']="<META HTTP-EQUIV=Refresh CONTENT=\"10; URL=index.php/\">";
    $this->template = $this->config->get('config_template') . "/template/error/not_found.tpl';
} else {
    $this->template = 'default/template/error/not_found.tpl';
}
=========================


On the template/error/not_found.tpl


<head>
<?php
if(isset($metatoredirect)){
    echo $metatoredirect;
}
?>
</head>


By this it is told that when page is not found message is shown it will redirect to the index page after the 10 sec.

How we can redirect the page in the opencart

No comments:

Post a Comment