Extra Topics (Joe’s Blog Site)

What I find interesting, I blog it here…
Your Ad Here

Situation

At the Joomla/Mambo administration backend, when you click Insert Image on the content editor, a blank window appears. This has something to do with the javascript in relation with the way you typed your URL and the Live Site setting on you Global Configuration. You have to add or remove the ‘www.’ prefix on your address depending on the setting on your Live Site setting on you Global Configuration at the administration backend.

Temporary and inefficient work-around

Go to your administration backend and go to Site|Global Configuration then Server tab and check your Live Site configuration. If your Live Site settting is like:

http://extratopics.com (no ‘www.’ prefix)

then you also have to remove the ‘www’ prefix when you go to the administration page like:

http://extratopics.com/administrator/ (also has no ‘www.’ prefix)

for the Insert Image to work properly.

But if you do have a ‘www.’ prefix on your Live Site setting then you should also add the prefix on the admin address so you could insert images properly.

What others suggest

Most users suggest that you add a ‘www.’ prefix on your Live Site setting. This is NOT a good idea because you’re simply switching the problem to the other. Meaning, adding a ‘www.’ prefix to the live site setting would also require you to add a prefix everytime and vise versa.

How about the front end?

We have been focusing on the backend and the Insert Image issue. But you must remember that the Live Site setting affects your Joomla/Mambo site globally, that is, incuding the front end. Adding a ‘www.’ prefix on the Live Site setting would also require all your visitors to add a ‘www.’ prefix when they type your address. If they don’t add a prefix, some of your javascript based modules and components might not work properly. You forgot about this didn’t you? Even I myself have neglected this.

Now also if you remove the prefix on the Live Site settings, all visitors must also remove the prefix for some javascripts to work. Now we can’t tell all visitors what to type on the address can we?

Proper solution to all of these

Open the configuration.php file found in your Joomla/Mambo installation root folder and find:

$mosConfig_live_site = ‘http://yourdomain.com’; (with or without ‘www.’)

Replace with:

$mosConfig_live_site = ‘http://’ . $_SERVER["SERVER_NAME"];

That’s it! This is a very simple fix and is very flexible. The Live Site setting will automatically change depending on what the admin or visitor type on the address bar without worrying whether they use a ‘www.’ prefix or not at the front end or at the back end.


Tell a Friend

My wife, who is also a web developer, encountered this error on her page. She was trying to insert a YouTube video using javascript when this error occurred. So I’ve searched Google for a solution.

It happens when you try to modify tags which are not a direct child of the <body> tag while Internet Explorer is still loading the page. It means Internet Explorer doesn’t want you to modify tags which are inside another tags other than the <body> tag, until it finishes loading the page. I found several solutions from Microsoft and other forums but I don’t like their solutions because some are messy and impractical because they’d ruin your html codes. I found this great solution from mystic coders.

To solve this problem, we need to create an ActiveX plugin that would automatically download and install FireFox on their computer and tell the users not to use Internet Explorer anymore… nah, just kidding! We need to tell Internet Explorer not to execute any script until if finishes loading the page. To do that, follow the following steps:

  1. We need download a small javascript framework called mootools and save it as “mootools-1.2-core-nc.js” for example then upload it to your web server.
  2. Include this script between your <head> and </head> tags like:

    <script src=”mootools-1.2-core-nc.js” type=”text/javascript”></script>

  3. On the <body> tag, put and onload event and put this script window.addEvent(’domready’, Site.start); , for example:

    <body onload=”window.addEvent(’domready’, Site.start);”>

That’s it! Very clean and simple. No need to mess up your html codes as suggested by Microsoft and other forums.


Tell a Friend