Home
Developers

Developers

  • Documentation
    • Developer Guide
    • API Reference
    • Style Guide
    • How-To
    • Troubleshooting
  • Submit a Flake
  • Support

Pageflakes How-To and Troubleshooting Guide

  • Manage Flake Instances
  • Server-Side Scripting
  • Auto-Save Settings
  • Storing an Array into a Profile
  • Using CSS
  • Access Web Services from Flakes
  • Flake Development Tools
  • Troubleshooting
Home » Documentation » How-To

Server-Side Scripting

Flakes do not necessarily have to be hand-coded using script and XML. They can be written in any web scripting language, such as PHP, Perl, JSP, ASP, ASP.NET, and so forth.

The Pageflakes framework passes a variety of parameters in HTTP headers, such that the server-side scripts have all the necessary information to build a flake. These are described in Server-Side Scripting.

When using server-side script, it is occasionally useful for the server script to pass parameters to the client script. This can be done in several ways.

Using hidden <input> elements, the server script can set values in those elements for the client script to retrieve later.


<div id="_PAGEFLAKES_Results" class="RssReaderResults"> 
  Loading... 
 </div> 
 <% 
  string rssUrl = "http://www.alistapart.com/rss.xml"; 
  string[] parameters = Request.Url.Query.Split('='); 
  // Get the rss url 
  if (parameters.Length > 1) 
  { 
    rssUrl = parameters[1]; 
  } 
  rssUrl = HttpUtility.UrlDecode(rssUrl); 
%> 
<input id="_PAGEFLAKES_RssDefaultUrl" type="hidden" 
 value="<%=HttpUtility.HtmlEncode(rssUrl)%>" />

Alternatively, the server script can generate the necessary client script:


<script id="_PAGEFLAKES_InstanceSpecificVariables"> 
 var _PAGEFLAKES_array = {
  "<%= arrayItem1 %>", "<%= arrayItem2 %>", 
 "<%= arrayItem3 %>" }; 
 var _PAGEFLAKES_myURL = '<%= someServerSideVariable %>'; 
</script>

function com_pageflakes_devdocs_WelcomeFlake(id) 
{ 
 this.load = function(instance) 
 { 
  this.array = eval(id + 'array'); 
  this.myURL = eval(id + 'myURL');
 }
}
‹ Manage Flake InstancesupAuto-Save Settings ›
»
  • Printer-friendly version
  • Add new comment