Experiments in Domain Parking

Published on May 8, 2008 by in Domain Names

I had just paid for several domains that I had planned to build websites on yet have not had time to do them. You know web entrepreneurs, they are always looking for that next great website.

While I am not one that has taken up the reigns of the domain name rush, I was around early enough that I could have grabbed just about anyone that I had wanted. It's too bad for me that I wasn't the greedy one or I might have got that million dollars I have always wanted. I have always said its better to be rich than famous.

Well anyways I decided to test domain name parking. I found that there are many places that you can park a domain. Some places require that you have 10 or more to park, others want you to pay a fee. I opted to use Name Drive because it was free, and the generated pages actually looked better than some parking sites.

The following domains are ones I have been paying on for years. I had intended to use them as I described them, I will see if parking can at least pay for the cost of ownership - Original plan was to create a site for people to book hotels based on the highest hotel ratings. It may not be that now, but at some point I hope I will have time to finish it - Local golf portal site. One place you could go to find local golf info - Local Restaurant guide - Whats happening on the local music scene - Another Hotel site - Shopping portal

The true test will take a few months. The hard work begins by trying to get the domains to just show up in search engines. After that, its just a matter of time to see if this free parking works.

As time permits I may take one domain and populate it myself with google ads and see how well I can do on my own versus the free parking sites.

For those of you that think you want to try your hand at this, the first thing you will need to do is buy several domain names. Domain names can be bought all over the net, but do a poor programmer a favor and buy it from me at While I don't make alot off of them, maybe I can buy myself lunch or something.

 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 

Javascript Auto Focus Form Element

Published on May 5, 2008 by in Javascript

One of the main reasons I decided to have this blog is to create a reference place so I could easily find code or how to do things from time to time. Usually I have to sift through code trying to remember the last place I used something. From here on out I plan on posting code snippets as I run across them. Today I woke up to an email requesting if a signup form or member login form was opened, they wanted the cursor to automatically focus on the username or the first element of the form. To be honest, I didn't even know it could be done from a page open. So the first thing I did was open up Google and search until I find a way. I an not too ego minded to think I know everything. There is always someone that has found a better way.

Here is the JavaScript code:

Here is the XHTML part of the code:

For those that are a little new to javascript. The javascript should go in the document HEAD. The "element" can be changed to the id of the field you are working with.

 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 

Variable Variables and Template Lite

Published on May 1, 2008 by in PHP, Template Lite

There is one programing concept that always hurts my head, and that is the variable variables or dynamic variables. What dynamic let you do is access data from the value of the a variable you are viewing. (See I told you it would hurt your head)

$b =20;  // set the value of b
$c="b";  // set c to the name of the variable you want to view
$d=${$c}; // the variable variable  $d is now equal to 20

Many of you are probably asking yourself, " OK I understand that , but why do I need to do that?"
The number one place I use this, is in a web grid form. Any place you need to update/or delete data in that grid. Below is an example of what a grid of data may look like:

Data Grid

The issues you face in the above grid is how do I delete multiple items and change multiple elements of data in grid once it is submitted. The solution is you assign each field a row number and add that to the field name.


Note each field had its name attached with a _row number so you will see an id_1 as a field name. After this form is submitted you can use the below php code to get the values dynamically.

// Check for item delete
if ((isset($_POST['delete'])) or (isset($_POST['delete_x']))){
for ($i=0; $i<=$totrecs; $i++)
// Another way to do this is this way
// $tempvar="id_".$i;
// $tid=$_POST[${$tempvar}];
if ($tdel=="on")
// Delete Item, the item ID is $tid
} // Loop
} // End Post Check

Template Lite And Dynamic Variables
Form Data grid is also the reason I used dynamic variables in templates. Once I have edited a data grid I need to set values in the grid, select drop downs and, check radio or check boxes. There is some extra steps you need to do to use them and it also depends on how you pass your data to template lite. The following is an example showing a more complex use of variable variables.

{foreach key=key2 value=item2 from=$jetarray }
{ assign var="dummyvar1" value="`$item2.jetski_id`_bookid"}
{ assign var="dummyvar2" value="`$item2.jetski_id`_owner"}
{ assign var="cellcolor" value="`$item2.jetski_id`_color"}
{ assign var="dummyvar3" value="`$item2.jetski_id`"}

 {if $item[$dummyvar1]!=""}
   {if $session.myid == $item[$dummyvar2]}



Note we assigned a variable $dummyvar1 with the value $item2.jetski_id and appended _bookid to that variable name. Jetski number 1 turns into 1_bookid. After that we pull the value out of the array $item[$dummyvar1] so what we are actually doing is viewing $item['1_bookid'].

While there are some other uses for dynamic variables these are how I most recently have used them. If it helps someone other than myself, cool. Otherwise this is a place I have my own personal reference library.

 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 

Template Lite Modifiers

Published on April 23, 2008 by in PHP, Template Lite

One of the greatest tools I have in my library set is Template Lite . Template lite is a light-weight version of another template engine known as Smarty. Once you start using template lite you will be pleasantly surprised by how powerful yet modular it is.

My whole point of this blog is to talk about modifiers. A modifier enables you to pass some php modifying code into a template lite variable.


{$mytlitevariable|ucfirst }
//This would capitalize the first letter of the variable. 

What doesn't work

It is important to note that you cannot necessarily use this on all modify type php functions. Some php functions do not pass the main variable into the first option.

Using str_replace would not work as the passed variable is the third option in the command.

{$mytlitevariable|str_replace:black:brown } 
//is the equivalent to 
//which will not work.   You will have to  use it  via php:  
{php} echo str_replace("black","brown",$mytlitevariable)  {/php}

Modifiers Stacking

Modifier stacking allows you to make multiple changes to a variable by passing multiple modifiers to the template lite variable.

Example: {$myvar|ucfirst|truncate:40:"..."}

Creating your own Modifiers

Don't be afraid to create your own modifiers. When ever I run into something that I can't do I add it into template lite.

//Example: This is the source code for the indent modifier.  
//Once you create the modifier and save it in the plugins folder with the name 
//Note there are 2 extra arguments you can use with it as well.
function tpl_modifier_indent($string,$chars=4,$char=" ")
return preg_replace('!^!m',str_repeat($char,$chars),$string);

This is the start of my experimentation with blogs. I am constantly forgetting how to do things with template lite and other things. I plan on adding these tips and tricks to my blog so I have one place to search for the info. Feel free to comment as I realize I don't know it all but am willing to share my experiences along the way.

 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 
© Brainstorms of a Webdev