Override Content

On April 23, 2006, in Typo3 Snippets, by Brad

Recently I was working on a portion of a web site that required dynamic menus. However, I needed to override those dynamic menus for certain pages in the web site with custom menus. It is possible to achieve this using typoscript.

Continue reading »

 

Include the following typoscript in your root page template to dynamically generate a text based navigation menu that provides the full path of the current page from the root of the site.

depth = HMENU
depth.special = rootline
depth.1 = TMENU
depth.1.NO.linkWrap = | /  |*||*|  |

This will give a root line something like this:

      Home / Services /

 

Flush DNS Cache

On April 12, 2006, in Apple OS X, by Brad

You can clear the DNS cache on OS X by entering the following command at the shell prompt.

lookupd -flushcache

On a windows 2000/XP/2003 system you would type the following from a command prompt.

ipconfig /flushdns
 

Widgets on the Desktop

On March 14, 2006, in Apple OS X, by Brad

Sometimes you may want to display widgets on your regular desktop, rather than accessing them through Dashboard. Thankfully, achieving this is pretty easy. Type the followin in a Terminal window:

defaults write com.apple.dashboard devmode YES

Log out of your session, and then login again to restart the Dashboard process. That’s it! You now have the capability of displaying widgets on your regular desktop. How do you get them there?

  • Hit F12 to bring up your Dashboard
  • Find the widget you want on your desktop
  • While dragging the widget across the Dashboard, hit F12 to return to your regular desktop and drop the widget
  • To remove the widget from your desktop, just reverse the process. Hit F12 as you’re dragging the widget, and then drop it back on your Dashboard screen

Alternatively, you can just use the Yahoo Widget Engine (works on Windows as well!).

 

HTTP redirect using a .htaccess file

On August 15, 2005, in Tech Notes, by Brad

If you are sharing one IP address for multiple web sites, it may be necessary for you to setup some redirects. Whatever the reason, here is a sample of a .htaccess file that will do just that. This can also be used in the section of the Apache httpd config file.

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} www.mydomain.net
RewriteCond %{REQUEST_URI} !mydomain/
RewriteRule ^(.*)$ mydomain/$1 [L]
RewriteCond %{HTTP_HOST} mydomain.net
RewriteCond %{REQUEST_URI} !mydomain/
RewriteRule ^(.*)$ mydomain/$1 [L]

In this example, there are two domains sharing one IP address for web hosting. The first domain (which isn’t mentioned in the htaccess file is www.mymaindomain.net and the second domain is www.mydomain.net (note – these are obviously fictitious domains). The .htaccess file is located in the root of the mymaindomain.net webroot.

The second domain is located in a subdirectory of the web site for the main domain (e.g., http://www.mymaindomain.net/mydomain). The htaccess file basically rewrites the URL automatically if you request http://www.mydomain.net or http://mydomain.net.

Rewriting URLs is black magic to me. I managed to get the above rules working, but don’t ask me how to do anything more complex! Regular expressions are not my forté.

Oh.. here is another sample.

RewriteEngine on
RewriteCond %{HTTP_HOST}  ^mydomain.net$
RewriteRule ^/(.*)  http://www.mydomain.net/$1 [R]
RewriteCond %{HTTP_HOST}  ^newsite.mydomain.net$
RewriteRule ^/(.*)  http://www.mydomain.net/$1 [R]
RewriteCond %{HTTP_HOST}  ^docs.mydomain.net$
RewriteRule ^/(.*)  http://www.mydomain.net/index.php?id=docs [R]