Showing Different Block Content for Each Drupal Node

I want to give Google and other search engines some links to to crawl, but I don't want to have the whole list reapeated on every page of this site. Instead, I wrote a small php snippet to put a different link on each node page.

Each link needs a departure city and airport code. Since I only have a small number of values to choose from, I'm coding the values directly into the "cities" and "iata" arrays. (With a large number of choices, it would probably be more efficient to store them in a database table).

The arg($n) is a drupal function to give the nth argument in the url, starting at n=0 (e.g. for node/22/edit, arg(1) returns 22). I'm explicitly converting it to an integer to avoid errors for urls with non-numeric values (e.g. node/add/blog), then using fmod to take the modulus with the number of airports in order to choose an index value in the departure city and airport code arrays.


//define the list of cities and airport codes

//get the node number
$nnum=(int) arg(1);

//choose an airport number

//write the link
echo "<a href='$iata[$anum]'>" .
"Find cheap flights from $cities[$anum]";