How to theme search results drupal 6.x

Drupal 6 comes up with preprocess functions and templates which makes theming job easier. So here is my first post to make your theming job easier with drupal 6.x.

Lets take a scenario of having some text below each result in search result page, could be any kind of ad or some image or any HTMl component.

Step 1. Define a variable in a preprocess function in template.php file.
Step 2. Copy the search-result.tpl.php file from /modules/search directory to your current theme folder.
Step 3. echo the defined variable in the search-result.tpl.php file.
Step 4. Clear the template cache.


Step 1. Define a variable in a preprocess function in template.php file.
Append following code to template.php in current theme.

function mytheme_preprocess_search_result (&$vars) {
 
$vars['my_variable'] = t('I am here');
}


Step 2.  This is self explanatory

Step 3. echo the defined variable in the search-result.tpl.php file.
Append following code at end of search-result.tpl.php
if (!empty($my_variable)) {
    echo $my_variable
;
  }
Step 4. Clear the template cache.

Now you can edit these files and can customize your search result page. :)

Do not register Youmint.com

Do not register on Youmint.com
Website is not at all secure , Don't believe.

If you are technical person then you can see that while registering the form data is sent via GET method and your personal data is passed to server without encryption. Password and all details are sent via GET method. I don't even Want to check what features they are providing after registration if this is the start.

► I am not the alone ◄ Check what other blogger are saying
sumans blog

replace last occurrence of substring from string in php

Are you looking out for a built in function in php which replace last occurrence of sub string from string??

You are at right place then. check out the function below which easily replaces the last occurrence of sub string from supplied string.

  1. function str_lreplace(mixed $search, mixed $replace, mixed $subject)
  2. {
  3. return substr_replace($subject, $replace, strrpos($subject, $search), strlen($search));
  4. }

Life becomes for Commuters in Pune

Google launched Transit service in Pune (in partnership with PMPML)

Public transport is a vital part of the infrastructure that makes our cities run efficiently, and can help mitigate congestion, environmental concerns, and increasing energy costs. Google earlier launched Transit in Banglore and delhi and now they come up with the idea in pune, making millions of commuters happy, as they can find out bus schedules and routes for 320 of PMPML buses via Google Maps on desktop and mobile.


As an example, here is the route from Pune University to MG Road.You can now check the bus no and available routes easily.


PMPML is the second Indian Bus service to launch on Google Maps.

Power of Android

Was studying about android, as its being famous in mobile technology these days. Here is summery of my first research.

What is Android?
Android is nothing but a software platform for mobile devices which are based on most flexible operating system i.e. Linux. Android is developed by Open Handset Alliance and acquired by Google. Android is a software stack for mobile devices that includes an operating system, middleware and key applications.

History of google and Android.
Google acquired Android in in July 2005. Early it was a small start up company (actually 22-month-old startup) based in palo alto, CA. Co founder of this company - Andy Rubin, Rich Miner, Nick Sears, Chris White.

Android Development
Android applications are written in the Java programming language. The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java.
Download Android SDK


An Android package archive file marked by an .apk suffix. This file is used for distribution and installation of the application on the mobile device.

Power of Android application.

  • Phone's core applications and third-party applications are treated equally.
  • Android actually breaks down all the barriers of application development by providing lots of libraries and tools. e.g Android enables developers to obtain the location of the device.
  • By default, every Android application runs in its own Linux process.
  • Every application has its own virtual machine. So the app runs in isolation from other apps.
  • Each application is assigned a unique Linux user ID which is set with some permissions required by the perticular application only. Where as it is also possible that two or more android application share a same user id in some cases.

Android Architecture
android architecture

BASH shell script to rename file that has spaces

R  you looking for shell script which rename all files in a directory to replace unnecssery spaces in file names with -. Check following BASH shell script which,

1. Iterate a perticular directory specified in FILES variable.
2. Replaces spaces with - hyphen, and put it in temparary variable new_file. (sed "s/ /-/g"`)
4. Then simple MV command to rename it.

  1. #!/bin/bash
  2. FILES=/path/to/dir/*
  3. for f in $FILES
  4. do
  5. new_file=`echo $f|sed "s/ /-/g"`
  6. if [ "$f" != "$new_file" ]
  7. then
  8. mv "$f" "$new_file"
  9. fi
  10. done
  11. exit 0

papa kehtain hai acoustic guitar notations

PAPA KEHTE HAI GUITAR NOTATIONS - acoustic
-------------------------------------------------------------------------------

D| E|----------------------------------------------------------------||
H| B|----------------------------------------------------------------||
A| G|-------------------------5---7----------------------------------||
N| D|----------7----5---7-----------5-----------7--------------------||
E| A|--5-5--------------------------------6-5------------------------||
S| E|----------------------------------------------------------------||
H|
M| papa kehte hai bada nam karega
A|
N| E|----------------------------------------------------------------||
E| B|-------------------------------------------8-8-----7-8----------||
| G|--5-7----------------------7-7----7-7---5-------------5---------||
T| D|-------5-5------5-5--4------------------------------------------||
A| A|----------------------------------------------------------------||
B| E|----------------------------------------------------------------||
S|
| magar ye to koi na jane ke meri manjil hai kaha

-------------------------------------------------------------------------------

Share this post with your friends