Skip to content

Instantly share code, notes, and snippets.

@Asherlc
Created May 1, 2012 20:43
Show Gist options
  • Save Asherlc/2571213 to your computer and use it in GitHub Desktop.
Save Asherlc/2571213 to your computer and use it in GitHub Desktop.
<?
var title;
var description;
var image
var params = Request.getParameterList();
var key_pattern = /_KEY/i;
for(var index in params) {
if index.match(key_pattern)
{
page_param = index;
page_id = items[index];
}
}
var page_type = page_param.replace('_KEY','');
var page = DB.getObject(page_type, page_id);
var page_url = Request.getURL()+page_param+page_id;
var image_condition = new Condition('path','=','%/images/'+page_id+'.jpg');
if (DB.getObjects(image_condition)) {
image = '[[YOUR BASE URL HERE]]'+page_id+'.jpg';
}else
{
image = '[[DEFAULT IMAGE HERE]';
}
switch (page_type)
{
case 'signup_page':
description = page.preFooter;
title = page.Title;
break;
case 'donate_page':
description = page.Custom_Donation_HTML;
title = page.Reference_Name;
break;
case 'action':
description = page.Footer;
title = page.Title;
break;
case 'event':
description = page.Description;
title = page.Event_Name;
break;
case 'content_item':
description = 'Custom content item';
title = page.Title;
break;
default:
description = 'Salsa page';
title = 'Title';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment