Return to Snippet

Revision: 38042
at December 23, 2010 04:37 by powerthru

Initial Code
var theTitle = "Join more than 216,249 Americans who want bold action on climate change.";

var tracking_code = salsa.getParameter("code");
if(tracking_code == "") tracking_code = 'none';

//this gets some parameters from the URL

function getTitle(){

var where = Request.getURI() ;
var match = /[a-zA-Z0-9\-]+$/i.exec(where);

if(match != null) {
	var shorturl = /[a-zA-Z0-9\-]+$/i.exec(where);
	var orderBy = 'Last_Modified DESC';
	var conditions = [ new Condition('slug', 'IN', shorturl)];
        var items = db.getObjects('publish', conditions, orderBy);
        for each (item in items) {
         var table = db.getObject('database_table', item.database_table_KEY);
         var ref = db.getObject(table.table_name, item.table_KEY);
} else {
var lists =Request.getParameterList();
for each (list in lists) {
     if( == 'action_KEY'){
         var camp=db.getObject("action",list.value);
     }  else if( == 'donate_page_KEY') {
         var camp=db.getObject("donate_page",list.value);
     }  else if( == 'tell_a_friend_KEY') {
         var camp=db.getObject("tell_a_friend",list.value);
     } else {

<html xmlns="">
<title>1Sky | <?=getTitle()?></title>

Initial URL

Initial Description
This was developed for 1Sky to write out titles to the template.  Thsi signle template can handle many DIA pages.  (Donation, Action, TAF).  It can determine what kind of page it is on by reading the URL and can even handle short URLs

Initial Title
SALSA Template Script to generate dynamic titles

Initial Tags

Initial Language