Categories
Linux

Showing the path in the Linux command prompt

[sourcecode language="php"]
# show full path of current dir in linux command prompt
PS1="[\u@\h \w]\\$ "
[/sourcecode]

Categories
WordPress

Fixing the space between < and ?php in source code blocks

WordPress can have the disconcerting habit of inserting a space between the < and ?php when you want to show a code block in a syntax-highlighter plugin. To cure this, go into your WP Admin page, select the Settings menu, Select the writing submenu, then uncheck the WordPress should correct invalidly nested XHTML automatically option.

Categories
CSS Web Development

Avoid 'page jump' by forcing a scroll bar

Occasionally a web page jumps horizontally because a switch of page or change of content causes a vertical scroll bar to appear.

This can be avoided with a little CSS trick;

1
2
3
  html {
    overflow-y: scroll;
  }

This can be placed in the <head> element of a page that is prone to the problem, or in the header include file for a site.

The result of this is that when a vertical scroll bar is not needed on a site, its place is taken by an unobtrusive pseudo-scroll bar, greyed out like other inactive controls.

Categories
Web Development

Web Development Links

This is a collection of useful links for web development.  Not my content, but useful nonetheless!

Categories
PHP

Strip the extension off of a filename in PHP

Here's a useful function to strip the extension off of a filename.

if($ext !== false) {
$name = substr($name, 0, -strlen($ext));
}
return $name;