Tools & Tips

You are here

This can be achieved using string manipulation functions in PHP. First we find the position of the desired character in the string using strpos(), substr(), ltrim, and trim() $new_name = substr($...
If you would like to remove everything after and including "By", string manipulation functions in PHP will do the trick. $variable = substr($variable, 0, strpos($variable, " By "));
Using mod_rewrite, you can exclude specific directories from rewrite rule. Adding the following before all rules will end the rewriting process. RewriteRule ^(folder)($|/) - [L] (put this above all...
The following technique allows you to Auto-Enable SCAYT and the Browsers Native Spell Checker in a WYSIWYG Using CKEditor Create a .js file enable_scayt_ckeditor.js I n that file add the following:...
Using the following javasript in your input field it is posible to restrict the text being entered to numberic values only. <input type="text" name="quantity[]" value="0" onkeypress="return (event...
You can sort the display of an array or a while loop in ALphabetical order in (n) columns...This example, n=3 <?php $n = 3; sort($some_array); // Make alphabetical...Or if from a Database query...
If you have an SQL file that is several hunded MB that you would like to import to your servers database, phpMyAdmin will not work, as the file will be too large. You can achieve this by doing the...
Prevent users from posting unwanted URL, and protect yourself from malicious posts or in appropriate urls being posted in your content. function removeURLs ($haystack) { // unwanted tags separated by...
Using Javascript and jQuery you can force tables with width greater than 900px to have a width of 100%. If the width > 900px the jQuery and Javascript replaces is with 100%. <script type="text/...
Here's a simple function for formatting US phone numbers with 7 to 10 digits with possible extensions. $phone = trim(stripslashes(strip_tags($_POST['phone']))); $phone = preg_replace("/[^0-9...

Pages