Post by alexmitev » Wed Feb 16, 2011 7:08 pm

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?

New member

Posts

Joined
Wed Jan 19, 2011 10:38 pm

Post by Xsecrets » Wed Feb 16, 2011 9:29 pm

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


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by alexmitev » Wed Feb 16, 2011 10:55 pm

But why cannot be the <base> tag be removed, what is it used for?

New member

Posts

Joined
Wed Jan 19, 2011 10:38 pm

Post by Xsecrets » Wed Feb 16, 2011 11:16 pm

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


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by Qphoria » Wed Feb 16, 2011 11:27 pm

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

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by zlomovsky » Thu Sep 05, 2013 4:47 am

Just did it. :)

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="" />
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.

User avatar
Newbie

Posts

Joined
Thu Sep 05, 2013 4:33 am

Who is online

Users browsing this forum: No registered users and 52 guests