Archive for the ‘PHP and MySQL’ Category

Our Studio Blog has Moved

January 3, 2014

The Tinstar Graphic Design and Studio Blog has moved – we’ve brought it back under the wing of our main website. Come by any time.

Advertisements

Pass dynamic data from a link to a form

August 22, 2013

In WordPress, use the following to extract a string from a URL:

$jobreference = $_SERVER['QUERY_STRING'];

So from a previous page you can add a dynamic string to a link. When it leads to a contact form, the unique string can be extracted and echoed into a form field. For example, from:

http://www.website.co.uk/page?string

$jobreference will be: “string”

HTML Entities for Triangles

July 10, 2013

I’m always having to look these codes up – so where better than our own blog? The HTML codes for pointy triangles are:

For HTML Entities
◄ = ◄
► = ►
▼ = ▼
▲ = ▲

Thanks to StackOverflow

Get a Website root, Directory root and File root from PHP

January 20, 2011

If you want to see what root leads to your file, or if you want to grab breadcrumb links dynamically, you might find the following snippits useful. They will (respectively) echo the current site root, the current directory root and the complete root up to and including the current file name.


echo "Get current site root:";
echo($_SERVER['DOCUMENT_ROOT']);


echo "Get current site root & current directory name:
";
echo dirname(__FILE__);


echo "Get current site root, current directory name & current file name:
";
echo ($_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF']) ;