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

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

Don’t Get Smacked by Copyright Infringemnt

Developers do it all the time – they need an image for a website and head on over to Google images, put a keyword in and voila! Free pictures for everyone! Not so fast. Many of these images are protected under copyright law and if you get caught,

How important is color in web design?

Color is an extremely important aspect of web design. It can have a significant impact on the user’s perception of a website, its brand identity, and the overall user experience. Here are some reasons why color is important in web design: Branding: Colors can be used to create

Maintaining The Correct Keyword Density

Keyword density, by definition, is the number of times, expressed in a percentage, that a particular keyphrase or keyword appears in a body of text. So if your keyword appears 4 times and the number of words on the page is 200 then your keyword density is 2%.

Why is WordPress our Go-To CMS?

Easy. It’s easy. Easy to use, operate and teach. We have dealt with virtually every blogging and Content Management Software out there, in existence, forever. Seen them all. Virtually all of them have their individual issues, yes, even WordPress. But few are as intuitive and easy to learn.

Gainesville Web Marketing

North West Mini Storage and Warehouse is a new client of ours. We started optimizing their site about 3 weeks from the date of this post. Already a page 1 contender, our client now enjoys a surge in search engine traffic – all organic, all of it white