Have a question about a project?
Send me an email at any time.


View Latest news here.

Drupal Custom Login

Hey

I’m going to briefly go over some code that will allow you to place a login field any where on your drupal website.

First we have to write the condition that tells drupal to check and see if the user is logged in.

<?php global $user; ?>
<?php if ($user->uid) : ?>
(place code here to let the user know that they are logged in)
<?php else : ?>

Now you’ll notice there is an open “else” that we have to fill. Well after else you can put:

<form action=”/user” method=”post” id=”user-login-form2″>
<span style=”font-size:11px; line-height:10px; height: 10px; margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0pt; padding-top: 0pt; padding-right: 0pt; padding-bottom: 0pt; padding-left: 0pt; text-align:left;”> Username: </span>
<input style=”font-size : 11px;” type=”text” maxlength=”60″ name=”name” id=”edit-name” size=”15″ value=”" tabindex=”1″ class=”form-text required” />
<br>
<span style=”font-size:11px; line-height:10px; height: 10px; margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0pt; padding-top: 0pt; padding-right: 0pt; padding-bottom: 0pt; padding-left: 0pt;”> Password: </span>
<input style=”font-size : 11px;” type=”password” name=”pass” id=”edit-pass” size=”15″ tabindex=”2″ class=”form-text required” />
<br>
<input type=”submit” name=”op” id=”edit-submit” value=”Log in” tabindex=”3″ class=”form-submit” />
<br>
<a href=”/drupal/?q=user/register” title=”Create account”>Create account </a>|
<a href=”/drupal/?q=user/password” title=”Retrieve lost password”> Forgot Pass?</a>
<input type=”hidden” name=”form_id” id=”edit-user-login” value=”user_login” />

</form>
<?php endif; ?>

Now you can remove or modify the inline styles that I have in there. I had them there when I was playing around with the font size and spacing on thr4shmetal.com. There’s not much else to know. I tested this on drupal 5.x and 6.x Enjoy.

 

Good Post? Share it:
  • Digg
  • Live
  • E-mail this story to a friend!
  • Facebook
  • Google
  • Mixx
 

Verizon = Worst Support

My experiences with Verizon support have been terrible. Even when troubleshooting a cell phone issue, they never seem to know what they are talking about. I saw a video on you tube recently called “Verizon Math Fail” where some tech support agents didn’t follow a simple math concept. Quiet entertaining.

I had a similar experience recently. A client of my former employer insisted on using Verizon web hosting against my advice and ended up with a ton of problems. The Verison control panel is a piece of garbage with a ton of limitations. So I do what I always do when hosts have crappy cpanels. I connect directly. Of course they have limits on permissions that block any external IP address. So i called up there tech support to get my IP white listed.

The brillant staff over at verizon tried to convince me that the reason why I couldn’t connect to the mysql server was my screen resolution was too small. And when I suggested that there might be another reason why I can’t connect to there servers the tech support agent flipped out on me. I asked to speak to a manager, hoping to get someone who knew something about hosting.

The problem still isn’t solved, I recommend to stay away from Verizon for all there services besides mobile phones. There support sucks for that too however.

 

Good Post? Share it:
  • Digg
  • Live
  • E-mail this story to a friend!
  • Facebook
  • Google
  • Mixx

I’ve been on vacation for the last week, driving back and forth to Florida with no Internet. I needed to do some development so I installed wamp server on my machine a couple weeks ago and it ended up helping me out so much.

The 18 hour drive to Florida turned out the be a great opportunity to do some php programming. Wamp server lets you run php, mysql and apache locally so that you can test all of your programming by going to http://localhost/ on your machine.

The only issue i seemed to have are some errors with mysql GUIs such as the mysql GUI tools, and navicat for MySQL, but you just click “OK” to the error and carry on as usual.

I recommend that all LAMP programmers install this on your machines, you never know when you will be stranded without internet and in need to of a good local server to test code.

http://wampserver.com

 

Good Post? Share it:
  • Digg
  • Live
  • E-mail this story to a friend!
  • Facebook
  • Google
  • Mixx

Switch Statements Explained

For all of you who love to use “else - if” as thier primary conditional programming, switch statements are a great alternative.

the syntax looks like this:

<?php
switch ($var)
{
case 1:
  echo "Condition 1";
  break;
case 2:
  echo "Condition 2";
  break;
case 3:
  echo "Condition 3";
  break;
default:
  echo "This text appears when the var doesn't  match any case";
}
?>

$var can be set anyway you want, through a session so a content can be changed on login. I’ve used switch statements primarily when filtering websites out.

Check out my example:

below i am declaring the var “$cat” by getting the string from the url.

switch ($cat) {

case ‘hd’:
http://thatsnice.com/landing_case_study.php?cat=hd
break;

case ’sm’:
http://thatsnice.com/landing_case_study.php?cat=sm
break;

default:
http://thatsnice.com/landing_case_study.php?cat=
}

Switch statements are just another way of doing the same thing, I find that they are more organized within my programming and it is easier to add conditions later on.

 

Good Post? Share it:
  • Digg
  • Live
  • E-mail this story to a friend!
  • Facebook
  • Google
  • Mixx

My Experience with tiny MCE

So my latest project required me to create a text box that allowed the user to format text in anyway they needed to, and of course, store that in HTML format in a MySQL table for dynamic page creation. A colleague of mine suggested I used tiny MCE and for the most part, it worked out pretty well.

Tiny MCE is based out of java script and fairly easy to setup. Just make sure that all the include files are calling to the correct source and it should work right away.

Once bad thing about it would be the load time. It takes quiet a while to load all the javascript, images and CSS to build the field. This can be a turn off when testing and editing web pages.

Click here for the live demo, you’ll notice the load time is a bit much, Lauch Demo

Overall it ended up be a good solution for what I needed to do, but it might not be great for everyone.

 

Good Post? Share it:
  • Digg
  • Live
  • E-mail this story to a friend!
  • Facebook
  • Google
  • Mixx

Dual Screen Laptop Vid

This Video shows a first attempt at a dual screen laptop. The additional screen slides out from the side, and is only about 10 inches. I think that would probably take out a chunk more battery life to have it open, not sure if it’s even worth it,

check it out.

 

Good Post? Share it:
  • Digg
  • Live
  • E-mail this story to a friend!
  • Facebook
  • Google
  • Mixx