Adding line breaks within a string in PHP

This is something that has been on my “unsure” list for a long time. Partly because I haven’t really done my research on it and because, well, I just don’t require this very often. Finally, today I had a situation come up when I needed to ensure that the notes I am adding into the database are broken up with a line break between each note.

I know that there are these “\n” and “\r” or something like that but any time I’ve tried using them in the past it never worked consistently.

So today I decided to, once and for all, get to the bottom of this. Continue reading “Adding line breaks within a string in PHP”

Create A Quick Dashed Line In Photoshop

Every time I need a dashed line I have to create one from scratch and it really makes me mad, every time, that there is not a quick way to do this in Photoshop. Today, I found a way! Here is how to get a quick perfect dashed line every time you need it. Continue reading “Create A Quick Dashed Line In Photoshop”

Hand-Drawn Lines with Transparent Background PSD & PNG

While working on one of my projects I had to create a set of hand-drawn lines, scan and then isolate them so I can use them in my design. If you know me, you know that I don’t like to let a useful design go to waste by only using it once. This is why I put it up on the blog for others to use. This is a set of various width hand-drawn lines with transparent background so you can use them for anything. The original file is also in 300 dpi so this can be used in print projects. Download them below (under the image). Enjoy! Continue reading “Hand-Drawn Lines with Transparent Background PSD & PNG”

Huge 492 Quality Graphics Kit You Need

As I work on things I create various graphics. Why let all that goodness go to waste? I took some of those designs and expanded on them making them better, adding variations and different colors. This kit of 492 graphics contains a ton of price tag graphics, a couple of price tables, step lines, buttons and all kinds of other eye candy! Continue reading “Huge 492 Quality Graphics Kit You Need”

11 YouTube Video Background Border Design Ideas in PSD

Another series of Photoshop PSD files to share with you guys and girls. The last YouTube player button icon PSD file I posted here turned out to be pretty popular so I decided to do a series of YouTube video background border designs and share the PSDs here for everyone to use. I know as a designer, creating something that is needed all the time, from scratch every time, is no fun and gets kinda old real quick so once and for all, or for most projects anyway, here are the ready PSDs that you can dive into and edit as you like to apply to your project.

Download all of these file and feel free to use them as you please for your self or your business. Please link back to this page if you can.

Click here to download these PSD files »

Download all of these file and feel free to use them as you please for your self or your business. Please link back to this page if you can. :)

Click here to download these PSD files »

jQuery Time Zone Sensing Live Broadcast Countdown Mechanism

Having a countdown to a live webinar or some sort of event sounds like a simple idea. There are plenty of jQuery countdown examples on the Internet you can find but what I found out is that not one talks about how to adjust that countdown to the visitor’s time zone.

If we are having the broadcast at 6 o’clock EST, we can have the timer count down to 6 o’clock EST but because it is javascript based, the time it uses is client side machine time and so the visitor from California will see the countdown count until 6 o’clock his time (PST) at which point the broadcast will have finished.

To remedy this problem I had to dig around and hack this code together using the most popular jQuery script from Keith Wood here: http://keith-wood.name/countdown.html

I used a combination of PHP and JavaScript to communicate together and figure out where the script is opening at and adjust the timer accordingly. Lucky for you, I did all the work so just copy the code now and apply it to your project.

Download Source Code | View Live Demo

The Code

This is the CSS:

<style>

/* Countdown Timer */
#countDown { border:0px solid #ccc;display:block; width:500px; height:85px; margin:0 auto; position:relative; top:0px; background:url('YOUR_DOMAIN_GOES_HERE/js/timez2.png') no-repeat 10px bottom; }
#countDown div { float: left; width: 43px; height: 58px; background: url('YOUR_DOMAIN_GOES_HERE/js/numberz2.png') no-repeat 0 0; }
#countDown div.image0 { background-position: -0px 0px; }
#countDown div.image1 { background-position: -61px 0px; }
#countDown div.image2 { background-position: -122px 0px; }
#countDown div.image3 { background-position: -183px 0px; }
#countDown div.image4 { background-position: -244px 0px; }
#countDown div.image5 { background-position: -305px 0px; }
#countDown div.image6 { background-position: -366px 0px; }
#countDown div.image7 { background-position: -427px 0px; }
#countDown div.image8 { background-position: -488px 0px; }
#countDown div.image9 { background-position: -549px 0px; }
#countDown div.imageSep { background-position: -610px 0px; margin:0 4px; }
/* End Countdown Timer */

</style>

Just remember to upload the js directory to your server and replace the YOUR_DOMAIN_GOES_HERE with your own domain.

We start with a couple of DIVs, one will be visible and the other hidden. The visible DIV will hold the code for the countdown and the hidden one will hold the live player code.

.

<div id="bcastsoon" style="display:block;">
 <h1 style="text-align:center;margin-top:0px;">Live Broadcast In:</h1>
 <div id="countDown"></div>
</div>

<div id="bcast" style="display:none;width:560px;margin:50px auto;text-align:center;">
 <h1>Live Now!</h1>
 <div id="theliveplayer"></div>
</div>

.

Now we add the PHP/JavaScript code in the countdown DIV:

<div id="bcastsoon" style="display:block;">
 <h1 style="text-align:center;margin-top:0px;">Live Broadcast In:</h1>
 <div id="countDown"></div>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
 <script type="text/javascript" src="YOUR_DOMAIN_GOES_HERE/js/jquery.countdown.js"></script>

 <script type="text/javascript">

 $(function () {
 <?php

 ////////////////
 //                    //
 //  SETTINGS   //
 //                    //
 ////////////////

 // PLAY BROADCAST

 // week day :
 $live_day 	= 'Tuesday';	 

 // use 24 hour time (base this on Eastern Standard Time (EST)):
 $live_hour 	= '17';

 // miutes with leading zeros:
 $live_min 	= '45';		

 // seconds with leading zeros:
 $live_sec 	= '00';		

 // DELAY COUNTDOWN AFTER BROADCAST STARTED

 // add hours to the live_hour set above:
 $off_hour	= '1';

 // minutes with leading zeros:
 $off_min	= '15';

 // BROADCAST INFO

 //

 // live player code
 $live_code	= 'LIVESTREAM_PLAYER_EMBED_CODE';

 // live player heading title
 $live_title	= 'Live Broadcast!';

 // previous browadcast player code
 $off_code	= 'LIVESTREAM_PLAYER_EMBED_CODE';

 // replay player heading title
 $off_title	= 'Replay Of Last Weeks Broadcast';

 ///////////////////////////////////////
 //                                                           //
 //  DO NOT CHANGE ANYTHING           //
 //  BELOW THIS UNLESS YOU KNOW      //
 //  WHAT YOU ARE DOING                    //
 //                                                           //
 ///////////////////////////////////////

 // TARGET TIME
 $countdownweekday = $live_day;
 $countdowntimeh = $live_hour;
 $countdowntimeh = $countdowntimeh+5; // standardized time GMT 0
 $countdowntimei = $live_min;
 $countdowntimes = $live_sec;
 $nextmondayy = date('Y', strtotime($countdownweekday));
 $nextmondaym = date('m', strtotime($countdownweekday))-1;
 $nextmondayd = date('d', strtotime($countdownweekday));

 // FIX MONTH
 if($nextmondaym == '0') {
 $nextmondaym = '00';
 }

 // SERVER TIME
 $servermonth = date('m')-1;
 if($servermonth == '0') {
 $servermonth = '00';
 }
 $serverdate = date('Y').$servermonth.date('dHi');
 $targethouradj = $countdowntimeh-8;
 $targettime = $nextmondayy.$nextmondaym.$nextmondayd.$targethouradj.$countdowntimei;
 $offhouradj = $targethouradj+$off_hour;
 $offminadj = $off_min;
 $offtime = $nextmondayy.$nextmondaym.$nextmondayd.$offhouradj.$offminadj;

 // DETERMINE THE END OF BROADCAST
 if($serverdate >= $offtime) {

 $nextmondayy = date('Y', strtotime("Next ".$countdownweekday));
 $nextmondaym = date('m', strtotime("Next ".$countdownweekday))-1;
 $nextmondayd = date('d', strtotime("Next ".$countdownweekday));

 // FIX MONTH
 if($nextmondaym == '0') {
 $nextmondaym = '00';
 }

 }

 ?>

 // PLAY BROADCAST FUNCTION:
 function liftOff() { 

 document.getElementById('tempplayer').innerHTML = '';
 document.getElementById('theliveplayer').innerHTML = '<?php echo $live_code; ?>';
 document.getElementById('bcast').style.display = 'block';
 document.getElementById('bcastsoon').style.display = 'none';

 }

 // GET TIME ZONE
 var d = new Date()
 var gmtHours = -d.getTimezoneOffset()/60;

 // ADJUST TARGET TIME TO TIME ZONE
 var playhour = <?php echo $countdowntimeh; ?>;
 playhour = playhour+gmtHours;

 var targettime = '<?php echo $targettime; ?>';
 var targettimeoff = '<?php echo $offtime; ?>';
 var curY = d.getFullYear();
 var curMo = d.getMonth();
 var curD = d.getDate();
 var curH = d.getHours();
 var curM = d.getMinutes();
 if(curMo == '0') { curMo = '00'; }
 var curtime = curY+''+curMo+''+curD+''+curH+''+curM;

 //alert('target: '+targettime+' - cur: '+curtime+' - off: '+targettimeoff);

 // ARE WE LIVE?
 if((curtime >= targettime) && (curtime <= targettimeoff)) {

 // IF YES, PLAY BROADCAST:
 liftOff();

 // IF NOT, SHOW COUNTDOWN
 } else {

 $('#countDown').countdown({until: new Date(<?php echo $nextmondayy; ?>, <?php echo $nextmondaym; ?>, <?php echo $nextmondayd; ?>, playhour, <?php echo $countdowntimei; ?>, <?php echo $countdowntimes; ?>), format: 'DHMS', onExpiry: liftOff,
 layout:
 '<div class="image{d10}"></div><div class="t image{d1}"></div>' +
 '<div class="imageSep"></div>' +
 '<div class="image{h10}"></div><div class="t image{h1}"></div>' +
 '<div class="imageSep"></div>' +
 '<div class="image{m10}"></div><div class="t image{m1}"></div>' +
 '<div class="imageSep"></div>' +
 '<div class="image{s10}"></div><div class="t image{s1}"></div>'
 });

 } // END ARE WE LIVE

 });

 ////////////////////////
 //                                  //
 //  END LIVE SCRIPT     //
 //                                  //
 ////////////////////////

 </script>

 <div style="width:560px;margin:50px auto;text-align:center;" id="tempplayer">
 <h2><?php echo $off_title; ?></h2>
 <?php echo $off_code; ?><br><br>
 </div>

</div>

That’s that, you should now be reasy to countdown to your event. I recommend downloading the file for this rather than copy the code from this page. Here they are again:

Download Source CodeView Live Demo

Until next time.

~ Valiik

Custom Gear Shapes for Photoshop

Sometimes as I create logos, I require a custom gear shape and these are not easy to create in Photoshop. Well at least I have not mastered that skill yet anyway. Apparently, as I come to find out today, there are custom shapes that you can download for your Photoshop that are perfect gear shapes every time. I mean I know, I should have already known this but between development and day-to-day production stuff, I just don’t have time to sit down and think about anything else except the task at hand.

Ok, so here is the custom shapes I found that have a nice variety of custom gear shapes that you can load up into your Photoshop and use to your satisfaction.

Naderbellal – Download Custom Shapes

Enjoy!

Finally A Tool For Cross-Browser Compatibility Testing

It’s about time one of the big software companies came out with a tool for testing the web design in multiple browsers all in one place without having to have a computer farm sitting there with all different browsers loaded for testing.

I’ve been struggling with this problem just like most web designers, I assume. I have two machines, an iMac and a PC lap top. The mac has Parallels Desktop on it so I have 3 Windows installations running on it, each with different version of Internet Explorer on it. It is a pain to run because Parallels is a resources hog and having it run at in the background all the time slows the machine down but having to start it up just to test a design is annoying because it takes it long to start up and I just wished there was a better solution.

On my PC I have IE6 installed as well as Firefox3 and Chrome. That is fine and works well for me but I still do not have a IE8 testing browser so that was kinda bad.

As I was reading the last month’s Web Designer magazine they talked about Adobe BrowserLab and that was great news for me! Quickly I went and logged into my Adobe account and signed up. I got a year worth of complimentary membership to Adobe Live, but I am not sure if the word “complimentary” means that they are going to charge for it after my subscription expires. Any way, I ran the test and it worked great! So not I am a happy camper and my sites should now work well in IE8.

Tell me your Browser compatibility horror story in the comments. Would love to hear what your testing setup looks like.

Later.

~ Valik

Top 3 Of My Favorite Web Design Creativity Inspiration Blogs

Being a creative professional, the creativity bucket only goes so far before it needs to be refilled. Some like going out for a walk, some read a book, I like to visit the 3 of my favorite blogs. Why only three? Because, honestly, I just don’t have time for any more and these 3 consistently deliver the creativity ideas by the truck load. You may already have heard of them and you night have not, either way you should take another look and make sure you add them into your favorites and visit them often to reload.

Continue reading “Top 3 Of My Favorite Web Design Creativity Inspiration Blogs”

Web Design As A Hobby

Denial is a big stress point… I finally realized that web design is my hobby. I’ve been spending lots of time building various websites for my self, most of which never got finished, some just sit there. So to call it a business would be a lie, to my self. I find myself getting pretty excited when I get a new idea for a website. Right away I go and get a good domain for it, and think of the design. Spending a few hours in Photoshop designing the site is lots of fun. Then getting into the programming and making it come alive. All that makes me happy… lol, yes I am a nerd.

The ideas I get are good but most of them are not real great so they never go anywere because I dont’ spend enough time taking them through all the way. After the fun wears out I find my self jump onto the next exciting project.

With this kind of thing happening about every month to every other month, I do have quiet a few websites stacked up that are half finished or mostly just a good domain for it. Maybe some day I’ll get back to them and finish them.

Before I realized that this is what I do for fun, I thought this was a business that was really not going anywhere, i kept putting money into the domains and not getting anywhere with it. This created lots of stress for me. It’s so much easier now that I look at it differently. Another thing is it helps me not to jump on new ideas too quick and think them through a bit longer.

I must say I sill love finding new cool domains. They are hard to find but once you find one it’s like a Christmas present.

So now take a look at your self, your projects… Are you stressed out that they are not getting finished? Are there too many of them for you to focus on? You just might be fighting with it, web design might be your hobby and you might just need to relax and enjoy it.

Tell me about your web design habits in the comments.

Ok, lateroonie.

~ Valik