Part of our cms, and has been for the last 2 versions, is that users can have their own fonts for the menu titles in the front-end. Not only that but they can still admin their menus from our cms, so dynamic texts and custom font?? how do you do it??
well i do it by [...]
Here is one for ya: count the amount of weekdays (mo-fr) between a given start and end date.
function countWeekDays($start,$end){
$d=0;if($end>$start){while($start<$end){if(date('w',$start)!=6 && date('w',$start)!=0){ $d++; }$start = strtotime('+1 day',$start);}}return $d ;
}
A very nice bit of regex here to validate an emailaddress
function isEmail($email){
if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
return true;
}else{
return false;
}
}
A simple little function to get the full current URL
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
This is something i use quite a lot in many webaplis
function genpass ($length=6){
$password = ""; $possible = "0123456789bcdfghjkmnpqrstvwxyzQWERTYUIOPASDFGHJKLZXCVBNM";
$i = 0; while ($i < $length) {
$char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
if (!strstr($password, $char)) { $password .= $char;$i++;}
}
return $password;
}
A very usefull function Im using in our new CMS v6 to load the frontend css into an array in the backend. I can then use this array to:
- Generate a css file for use in the editor and page preview
- Extract menu/sub/subsub colours and sizes for custom font image generation for the menus
- And a [...]
Comments