Side-column-x-links.php File

THL Toolbox > Developers’ Zone > Web Development > side-column-X-links.php File

side-column-X-links.php File

Contributor(s): Than Grove, Steven Weinberger

Controlling Whether Links Open in Same or New Window

Below is code to use in /side-column-X-links.php file to control whether a link opens in the same window or in a new window.. This example is from /places/side-column-places-links.php

<?
	
	$requri = $_SERVER['REQUEST_URI'] ;
	$pgtype = "thl";
	if(preg_match("/places.thlib.org/",$requri)) {
		$pgtype="pd";
	} elseif (preg_match("//geotourism//",$requri)) {
		$pgtype = "geotour";
	} elseif (preg_match("//sera//",$requri)) {
		$pgtype = "sera";
	} elseif (preg_match("//drepung//",$requri)) {
		$pgtype = "drepung";
	} elseif (preg_match("//meru-nyingpa//",$requri)) {
		$pgtype = "meru";
	} elseif  (preg_match("//places/lhasa//",$requri)) {
		$pgtype = "lhasa";
	} elseif(preg_match("//culturalgeography|/places/maps|/places/monasteries/",$requri)) {
		$pgtype = "cultgeo";
	}
	$targetStr = ' target="_blank"';
	
?>
<h3 class="head global-links"><a href="#nogo" title="Entryways to Extensive Resources on Important Places">Places</a></h3>			
<ul>
<li><a href="/places/" title="Link to Places Homepage"<? if ($pgtype != "thl") { echo $targetStr; } ?>>Places Home</a></li>
	<li><a href="<?php echo $pdurl; ?>" title="THL Place Dictionary"<? if ($pgtype != "pd") { echo $targetStr; } ?>>Place Dictionary</a></li>
	<li><a href="/places/culturalgeography/" title="Tibetan and Himalayan Historical & Cultural
	Geography"<? if ($pgtype != "cultgeo") { echo $targetStr; } ?>>Cultural Geography</a></li>		
	<!-- <li><a href="/community/geotourism/" title="Learn How to Travel Responsibly in Tibet"<? if ($pgtype != "geotour") { echo $targetStr; } ?>>Geotourism</a></li> -->
	<li><a href="/places/monasteries/" title="Monasteries"<? if ($pgtype != "cultgeo") { echo $targetStr; } ?>>Monasteries</a></li>
	<li><a href="/places/maps/interactive/" title="THL Interactive Map"<? if ($pgtype != "thl") { echo $targetStr; } ?>>Interactive Map</a></li>
	  <li><a href="/places/maps/" title="Maps"<? if ($pgtype != "cultgeo") { echo $targetStr; } ?>>Maps</a></li>
	  <li><a href="/places/maps/collections/" title="THL Map Collections"<? if ($pgtype != "thl") { echo $targetStr; } ?>>Map Collections</a></li>
	 <!-- <li><a href="/places/lhasa/" title="Portal on Tibet&#0146;s Capital City"<? if ($pgtype != "lhasa") { echo $targetStr; } ?>>The City of Lhasa</a></li> -->
	<li><a href="/places/monasteries/sera/" title="Sera Monastery Portal"<? if ($pgtype != "sera") { echo $targetStr; } ?>>Sera Monastery</a></li>
	<li><a href="/places/monasteries/drepung/" title="Drepung Monastery Portal"<? if ($pgtype != "drepung") { echo $targetStr; } ?>>Drepung Monastery</a></li>
	<li><a href="/places/monasteries/meru-nyingpa/" title="Meru Nyingpa Monastery Portal"<? if ($pgtype != "meru") { echo $targetStr; } ?>>Meru Nyingpa Monastery</a></li>
	<li><a href="/places/culturalgeography/nepal/census/" title="Nepal Census Data"<? if ($pgtype != "cultgeo") { echo $targetStr; } ?>>Nepal Census Data</a></li>
</ul>

Provided for unrestricted use by the external link: Tibetan and Himalayan Library