How To Load CSS & Javascript Using Javascript / jQuery

[cc lang=”javascript”]
// load jquery UI CSS theme
$(“head”).append(“”);
var css = $(“head”).children(“:last”);
css.attr({
rel: “stylesheet”,
type: “text/css”,
href: “//ajax.aspnetcdn.com/ajax/jquery.ui/1.8.19/themes/smoothness/jquery-ui.css”
});

// load jquery UI and if available, run autocomplete
if (typeof jQuery().ui === ‘undefined’ || jQuery.ui === null) {
$.getScript(“//ajax.aspnetcdn.com/ajax/jquery.ui/1.8.19/jquery-ui.min.js”, function() {
loadJobTitles();
});
}
else {
loadJobTitles();
}
[/cc]

Scalable Cloud Web / App Hosting

Managing a scalable and high availability website is a lot of work and expensive. That’s why many startups get started with cloud-based web hosting like Amazon Web Services, which proved to be very scalable for Instagram. But, it can still be a bit expensive when you’re not sure your app with take off. PHPFog is a similar scalable PHP web hosting service that is cheap and looks like a good alternative when you’re just getting started. Check it out at

https://www.phpfog.com/pricing

Pure CSS Arrow (No Images)

[cc lang=”html”]
.arrow-up {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;

border-bottom: 5px solid black;
}

.arrow-down {
width: 0;
height: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;

border-top: 20px solid #f00;
}

.arrow-right {
width: 0;
height: 0;
border-top: 60px solid transparent;
border-bottom: 60px solid transparent;

border-left: 60px solid green;
}

.arrow-left {
width: 0;
height: 0;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;

border-right:10px solid blue;
}

[/cc]

and here are a bunch of other CSS shapes

http://www.cssportal.com/css3-shapes/

or just use this CSS Triangle Generator

http://apps.eky.hk/css-triangle-generator/

Sending Text & HTML Email in PHP

Set up your email message with text/html boundaries as follows:
[cc lang=”php”]
–$boundary
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Text email content goes here

–$boundary
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

HTML email content goes here

–$boundary–
[/cc]

Let’s say the message above is in the variable $message.

Set headers and send email.

[cc lang=”php”]
$boundary = uniqid(“”, true);
$additional_headers = “Mime-Version: 1.0rn”;
$additional_headers .= “Content-Type: multipart/alternative; boundary=$boundary” . “rn”;

mail($to, $subject, $message, $additional_headers, $additional_parameters);
[/cc]

If the user’s email client supports HTML, it will show the HTML version, otherwise, it’ll show the text version.

Using eval() to Evaluate a PHP Script in Another PHP Script

Let’s say you have a PHP script called message.php with the following contents:

[cc lang=”php”]
Hello, $name;
[/cc]

You can evaluate this code by reading it into a variable as using the eval() function as follows:

[cc lang=”php”]
$name = “David”;
$fh = fopen(“message.php”, ‘r’);
$message = fread($fh, filesize(“message.php”));
eval(“$message = “$message”;”);
echo $message; // prints Hello, David
[/cc]