? Earlier 10 items total Later ?

On this page:?

Random Number

$randomnumber= rand(1,10);


Replace 1 and 10 with the range you want to pick a number between.

Display Current Year

Useful for example for automatic copyright notices:

© Copyright 2004 - 

Date In The Future

Display In 2-Column Table

The below can be applied to MT, EE, etc, and will display the content in a 2 column table. The EE tags below are just an example, it will work equally well if you replace it with MT, Wordpress, etc, tags.




{exp:gallery:categories gallery="{gallery_name}"}
";} ?>


Insert other tags here.


";  $set_table="0";} ?>
{/exp:gallery:categories}

Get Today's Date & Time

$today = date("F j, Y");


http://www.php.net/manual/en/function.date.php

Use PHP Inside EE Entries

You'll need the following plugins:
Allow EE Code: http://www.pmachine.com/plugins/allow-eecode/
Allow PHP: http://loweblog.com/archive/2005/06/03/ee-allow-php-plugin/

Set text formatting for the field you want to use this on to "None" (Admin > Weblog Administration > Custom Weblog Fields).

Change your template by adding the Allow EE tags around the field:

{exp:allow_eecode}{body}{/exp:allow_eecode}


Now you can use PHP inside your entries like this:

Bla bla regular entry text

{exp:allowphp} echo "This will be processed as PHP."; {/exp:allowphp}

Strip A String using explode

http://www.php.net/manual/en/function.explode.php

In this example, I need to strip the page's current URL to take off anything that follows a ? in that URL.

"; 
echo "$fs_refer[1] is the bit that used to follow the ?.";
 ?>

Trim a line of text to X characters

Clean Up Form Input

Trim/Remove Spaces

To remove multiple occurences of whitespace characters in a string an convert them all into single spaces, use this:



Strip whitespace (or other characters) from the beginning and end of a string

$variable = trim($variable);

? Earlier 10 items total Later ?