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');
}
}
