I've searched the web and cannot find a way or variable to determine what page OpenCart is displaying.
My customer wants a different header and footer on the firstpage. So I need some sort of code that does the following in the tpl files:
<?php if ($page == 'firstpage') { ?>
...
<?php } ?>
Any clues?
My customer wants a different header and footer on the firstpage. So I need some sort of code that does the following in the tpl files:
<?php if ($page == 'firstpage') { ?>
...
<?php } ?>
Any clues?
You can try using:
gets actual page url not a mod_rewrite one.
Code: Select all
<?php
$url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo $url;
?>
-
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS
Is there no such variable like $this->config->get('route')?
I was hoping for if ($this->config->get('route') == 'common/home')
because I find this solution kind of a mcgyver:
if ($_SERVER['REQUEST_URI'] == '/' || strpos($_SERVER['REQUEST_URI'], 'route=common/home') !== false) {
I was hoping for if ($this->config->get('route') == 'common/home')
because I find this solution kind of a mcgyver:
if ($_SERVER['REQUEST_URI'] == '/' || strpos($_SERVER['REQUEST_URI'], 'route=common/home') !== false) {
So close...TiM-SE wrote: I was hoping for if ($this->config->get('route') == 'common/home')
Code: Select all
if (isset($this->request->get['route']) && $this->request->get['route'] == 'common/home') {
/// do some magic
}
Qphoria, that is the same as:
if (isset($_GET['route']) && $_GET['route'] == 'common/home') {
/// do some magic
}
It would not apply to seo urls or root /.
My previous post seems to do the trick, but in my picky opinion it's one condition too many ;b
if ($_SERVER['REQUEST_URI'] == '/' || strpos($_SERVER['REQUEST_URI'], 'route=common/home') !== false)
Thank you for replying
if (isset($_GET['route']) && $_GET['route'] == 'common/home') {
/// do some magic
}
It would not apply to seo urls or root /.
My previous post seems to do the trick, but in my picky opinion it's one condition too many ;b
if ($_SERVER['REQUEST_URI'] == '/' || strpos($_SERVER['REQUEST_URI'], 'route=common/home') !== false)
Thank you for replying
TiM-SE wrote:Qphoria, that is the same as:
if (isset($_GET['route']) && $_GET['route'] == 'common/home') {
/// do some magic
}
It would not apply to seo urls or root /.
My previous post seems to do the trick, but in my picky opinion it's one condition too many ;b
if ($_SERVER['REQUEST_URI'] == '/' || strpos($_SERVER['REQUEST_URI'], 'route=common/home') !== false)
Thank you for replying
adapt it for seo urls then
Code: Select all
if (isset($_GET['route']) && $_GET['route'] == 'common/home' || $_GET['route'] == '/' || $_GET['route'] == 'My_SEO_URL' ) {
/// do some magic
}
Who is online
Users browsing this forum: Baidu [Spider] and 13 guests