Created
May 1, 2012 20:43
-
-
Save Asherlc/2571213 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
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