Opencart get server url - opencart

I want to install opencart under a sub directory on my domain like example.com/myshop/ and I want to use some js/css files from the root or example.com/js/ in my template files.
What is the proper way to do it ?
opencart defines 2 constants after installation:
define('HTTP_SERVER', 'http://example.com/myshop/');
define('HTTPS_SERVER', 'http://example.com/myshop/');
Shold I define another constant like that:
define('SITE_URL', 'http://example.com/');
If so will there be any problem if I am going to use SSL in the feature?

The method you outlined is perfectly acceptable but I'd use protocol relative links in cases like this like src="//example.com/script.js" so you keep whatever protocol is currently being used.
In your config:
<?php define('SITE_URL', '//example.com/'); ?>
Link stylesheet:
<link rel="stylesheet" type="text/css" href="<?php echo SITE_URL; ?>stylesheet.css" />
If you use SSL it will not be a problem as long as you have a valid certificate installed for the domain.

Related

github pages unable to find css with sveltekit

I have a github pages static website at norricorp.github.io/sveltekit. The root of the site is sveltekit. (I also have an unrelated website at norricorp.github.io). The site is built using sveltekit.
Entering the website, I get the following error in the console.
Loading module from “https://norricorp.github.io/sveltekit/_app/start-248e1695.js” was blocked because of a disallowed MIME type (“text/html”).
If I use the navigation (which does as expected) I get the following errors
GEThttps://norricorp.github.io/sveltekit/_app/assets/start-a8cd1609.css
[HTTP/2 404 Not Found 15ms]
more like this then
Loading module from “https://norricorp.github.io/sveltekit/_app/start-248e1695.js” was blocked because of a disallowed MIME type (“text/html”). about
I suspect the problem lies in the svelte.config.js file
kit: {
target: '#svelte',
paths: {
base: '/sveltekit',
assets: '/sveltekit'
},
adapter: adapter({
pages: 'build', // path to public directory
assets: 'build', // path to public directory
fallback: null
})
}
Initially, paths was set ‘/’ or ‘./’ which caused navigation to use either norricorp.github.io/about(does not exist) or norricorp.github.io/sveltekit/about/about (same again). But navigation does now work with the above values but no formatting.
The generated index.html file is within the repo on the gh-pages branch.This looks correct.
<link rel="modulepreload" href="/sveltekit/_app/start-248e1695.js">
<link rel="modulepreload" href="/sveltekit/_app/chunks/vendor-111805ed.js">
<link rel="modulepreload" href="/sveltekit/_app/chunks/paths-45dac81d.js">
<link rel="modulepreload" href="/sveltekit/_app/pages/__layout.svelte-1d5e7523.js">
<link rel="modulepreload" href="/sveltekit/_app/pages/index.svelte-fdf5a78d.js">
<link rel="stylesheet" href="/sveltekit/_app/assets/start-a8cd1609.css">
<link rel="stylesheet" href="/sveltekit/_app/assets/pages/__layout.svelte-8ddef586.css">
I have cleared the browser cache. I have also created another github pages project under a different account so that it was a top level domain. Same result.
So the browser is looking in the right place, the files are there in the correct branch of the github repo but the browser is not finding them. Is github pages not serving these?
I had deleted the .nojekyll file and forgot to replace it .....

Django built-in server cannot decode URL parameters

I'm not sure if this is a Django-specific issue but right now I see it in my project.
Because browsers tend to cache favicon and I have changed them for my website, I came up with a trick to force anyone who have visited my site before to receive the new icons, adding "?" followed by some random characters to the image file name, so currently it is like this:
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'images/favicons/favicon-32x32.png?v=Gv6qnaoWO5' %}">
Now the issue is, the favicon is not loading and when I check the source I see this:
<link rel="icon" type="image/png" sizes="32x32" href="/static/images/favicons/favicon-32x32.png%3Fv%3DGv6qnaoWO5">
and when I click on the above link, I get 404 error from django.views.static.serve. If I remove the "?" and rest of characters, everything works fine.
If memory serves, this is normal encoding of special characters and the web server should decode it, but this is not happening on Django's built-in server.
So, is there a fix for this, or I should wait until moving the site to production?
static takes a filename, and builds the URL. A filename doesn't have query parameters. Add the query parameters to it after the fact:
href="{% static 'images/favicons/favicon-32x32.png' %}?v=Gv6qnaoWO5">

I cannot preview html in webstorm soft

I can not preview a html file in webstorm 9.0.1 when I run it, it shows web page is not available because in addressbar it shows localhost:63342/---project folder.---. How can I access from local harddisk html file.
And, another question can I preview html in google chrome/firefox as docable?
To access http://localhost you need to have running local server (like XAMPP or WAMPP). If you have no localhost server (or you have no idea if that thing exist in your computer) than you can't access http://localhost. That means any *.php file will be not usable.
If you are font-end developer, you don't need server. You can access your *.html files directly: file:///C:/path/to/file.html (in browser site url box). Also, for any external sources to work, path to that file must be relative:
//C://myProject
myProject
|-index.html
\
css
|-styles.css
\js
|-functions.js
You enter to browser url bar: file:///C://myProject/index.html
Your index.html looks like this:
<html>
<head>
<script src="js/functions.js"></script>
<-- WRONG:
<script src="http://localhost/js/functions.js"></script>
<script src="C:/myProject/js/functions.js"></script> // valid, but better to avoid
-->
</head>
</html>
To preview HTML file on disk (using file:/// protocol) in WebStorm, hold Shift when choosing a browser

What is the .. css source showing up in Chrome Inspector when using Zurb Foundation 4?

I'm using Foundation 4 (the Sass version) and most elements have styles applied to them that are coming from a source listed simply as ... When I click on it to see what it is I get the following:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Authorization Required</title>
</head><body>
<h1>Authorization Required</h1>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
</body></html>
What is this source? Shouldn't everything be compiled into foundation.css?
Check your server: If you put an image (foo.jpg) in your directory, can you open it and see it in your browser? I don't have enough details to help you (OS, server, ...) but you probably need to look this way. If the file aren't opening, you have problems in your server config or file permission!
(#admins : sorry, it should be a comment but it seems I don't have sufficient rep to reply to the comment)
I just noticed that whenever .. shows up in Inspector the line number shown matches that of thee selector in the .scss file. I have no idea how this works, or what exactly is responsible for this.
Oh! Just figured it out! It was the experimental SASS support feature which I had enabled in Chrome!
Mystery solved.

IE6 Z-Index Difference Between 2 Servers

So, I have 2 servers that serve pages. I am running ColdFusion on Windows Server 2003 with IIS6. I created the site and synchronized the files between the 2 servers. In the right hand side of my site is a popup div for the search. On Server1 in IE6, this div works perfectly, on server 2 it gets cut off. Due to the synchronization software used, I cannot have different files on the two servers.
Any help is appreciated.
Thanks
Your IE6 stylesheet if failing to load for the second site.
This URL works:
http://www.sdccc.org:81/styles/03-ie6-fix.css
This URL doesn't:
http://www.sdccc.org:82/styles/03-ie6-fix.css
Oddly, this only appears to occur in IE itself - verifying the links above in Chrome and both of them work.
Update:
The port 82 server is returning Content-Encoding: gzip and Vary: Accept-Encoding headers - the port 81 server is not.
I suspect this is a bug with IE not accepting the gzipped content?
Two equal documents in the same browser has to produce the same page:
As I can see the document produced by each servers are practically the same, except for the CSS stylesheet:
<LINK href="./sd81_files/01-ejungle.css" type="text/css" rel="stylesheet">
and
<LINK href="http://www.sdccc.org:82/styles/01-ejungle.css" type="text/css" rel="stylesheet">
Yes, you can say that the files are the same, but when I saved the files into my computer, the second one did not arrive. Check the link and try again.
I finally figured it out! It seems that 2 image files, for some reason, didn't have read permissions on them on the second server:
/images/search_04_drop_04-ie6.png
/images/search_jason_04-ie6.png
updated the permissions and it started working.
Thanks for all of your help in this.