Hello,
I noticed OC uses a base tag in the header, which points to the the base path:
<base href="http://localhost/" /> (for localhost).
The problem with this is, I want to include some named anchors inside the "terms & conditions" page, like <a href="#shipping"> , <a href="#other">, etc., which all point to http://localhost/# instead of the current page.
I also tried to put some PHP code in the terms & conditions (href="<?php echo __FILE__; ?>#shipping">), however it's not parsed as PHP.
So, my question is, is it safe to remove the <base> tag, or what approach do you suggest for using named anchors?
I noticed OC uses a base tag in the header, which points to the the base path:
<base href="http://localhost/" /> (for localhost).
The problem with this is, I want to include some named anchors inside the "terms & conditions" page, like <a href="#shipping"> , <a href="#other">, etc., which all point to http://localhost/# instead of the current page.
I also tried to put some PHP code in the terms & conditions (href="<?php echo __FILE__; ?>#shipping">), however it's not parsed as PHP.
So, my question is, is it safe to remove the <base> tag, or what approach do you suggest for using named anchors?
just use the whole url for instance if you have seo turned on the link would be something like http://localhost/terms#shipping or whatever you have your seourl set to otherwise http://localhost/index.php?route=inform ... ?#shipping of course you'll have to change them all if/when you move from localhost.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
if you have seo urls turned on your url may be http://domain.com/category/subcategory/product so if you didn't have the base when the browser tried to look for relative stuff like images/css/javascript it would be looking from that base domain and of course it would not be found.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
IE also uses the <base> tag as the relative path base
It takes <base href="http: //www.site.com/">
+
<img src="image/img01.jpg">
to make the full path:
http: //www.site.com/image/img01.jpg
Otherwise you just see a broken site
It takes <base href="http: //www.site.com/">
+
<img src="image/img01.jpg">
to make the full path:
http: //www.site.com/image/img01.jpg
Otherwise you just see a broken site
Just did it. 
After removing BASE tag, take care of ~80 files in /catalog folder by putting "/" in right places in them.
For example:
All this files was found by searching RegEx text: ajax|catalog\/view|index.php
TBH, I think you even can remove "ajax" part from the regular expression.

After removing BASE tag, take care of ~80 files in /catalog folder by putting "/" in right places in them.
For example:
Code: Select all
//Before
url: 'index.php?route=checkout/checkout/country&country_id=' + this.value,
Code: Select all
//After
url: '/index.php?route=checkout/checkout/country&country_id=' + this.value,
Code: Select all
<!-- Before -->
<img src="catalog/view/theme/default/image/loading.gif" alt="" />
Code: Select all
<!-- After -->
<img src="/catalog/view/theme/default/image/loading.gif" alt="" />
TBH, I think you even can remove "ajax" part from the regular expression.
Who is online
Users browsing this forum: No registered users and 52 guests