Javascript called by PHP

Interesting little snippet.

What is going on here? Livewire gives you the low down.

 

 if($num_rowvs == 0){
 echo '<script>// <![CDATA[
alert("This is an alert message. I'm alerting you that you are totally awesome!");
// ]]></script>'; }

 

First, we’re creating a simple if statement in PHP.  Not entirely necessary, but prbobably the most common setup. Next we’re simply echoing the javascript alert – make sure to get your apostrophes and commas straight.

And that is it. Close out the tags and you have successfully called a javascript alert from inside PHP. Congrats.

More Web Design Blog Content

Project Gutenburg

Every heard of it? If not, make sure to check it out. They have tons of books online, free for anybody. Our favorite? A Connecticut Yankee in King Arthur’s Court by Mark Twain http://www.gutenberg.org/ebooks/86 Got a smartphone? Just download a free e-reader and you’re all set. Download the

Add YARPP to Custom Post Types: WordPress

A great little plugin for adding related posts to your blog has been around for a while: YARPP, Yet Another Related Posts Plugin. It’s fairly robust, for being free, but it does not natively support custom post types – a bummer. A quick way around this is to

Livewire SEO

The most common question we receive following a website launch is, “How can I increase traffic to my website without spending a fortune or buying ads?” Every website we develop for a customer includes what we refer to as “Basic SEO”; this simply means that we will fill

CSS Animation, The New Flash?

I’ve used it, so I am not immune to the pull of CSS animation, but what are we doing here folks? Used sparingly, CSS animation is at best a small way to augment conversions (button wiggle), but at worst it is a resource hog that destroys readability and

Date for our next Seminar is 4/8

Livewire Seminars are the perfect way to collect everything you need to know to do your own website optimization. We have what it takes to put your site on page 1 and we’ll teach you all of the not-so-secret info. Where to go, what to do, and how

No Business is too Small for Mobile

No matter how small your business is, you need to be on mobile. There are more mobile users these days than traditional desktop/laptop users, so the benefit is apparent. If your website is not mobile ready, you are at a distinct disadvantage. First, the user will probably have