the easiest way to learn how to code is to download a view addons which do a similar thing to what you want, and to use trace