Click here to Skip to main content
15,881,882 members
Articles / Programming Languages / PHP

Phalanger, PHP for .NET: Introduction for .NET developers

Rate me:
Please Sign up or sign in to vote.
5.00/5 (41 votes)
24 Jan 2007CPOL29 min read 247K   4.1K   140  
Phalanger is a PHP language compiler for the .NET Framework which introduces PHP as a first-class .NET citizen.
<%@ Page Language="PHP" MasterPageFile="~/Default.master" Title="Your Name Here | Admin"
	CodeFile="Albums.aspx.php" Inherits="Admin_Albums_aspx" %>

<asp:content id="Content1" contentplaceholderid="Main" runat="server">

	<div class="shim column"></div>

	<div class="page" id="admin-albums">

		<div id="sidebar">
			<h3>Add New Album</h3>
			<p>Before uploading your pictures, create an album to organize your pictures.</p>
			<asp:FormView ID="FormView1" Runat="server"
				DataSourceID="ObjectDataSource1" DefaultMode="Insert"
				BorderWidth="0" CellPadding="0">
				<InsertItemTemplate>
					<asp:RequiredFieldValidator	ID="RequiredFieldValidator1" Runat="server" ErrorMessage="You must choose a	title." ControlToValidate="TextBox1" Display="Dynamic" Enabled="false" />
					<p>
						Title<br />
						<asp:TextBox ID="TextBox1" Runat="server" Width="200" Text='<%# Bind("Caption") %>' CssClass="textfield" />
						<asp:CheckBox ID="CheckBox2" Runat="server" checked='<%# Bind("IsPublic") %>' text="Make this album public" />
					</p>
					<p style="text-align:right;">
						<asp:ImageButton ID="ImageButton1" Runat="server" CommandName="Insert" skinid="add"/>
					</p>
				</InsertItemTemplate>
			</asp:FormView>
		</div>

		<div id="content">
			<h3>Your Albums</h3>
			
			<p>The following are the albums	currently on your site. Click <b>Edit</b> to modify the pictures in each 
			album. Click <b>Delete</b> to permanently remove the album and all of its pictures</p>
			
			<asp:gridview id="GridView1" runat="server"
				datasourceid="ObjectDataSource1" datakeynames="AlbumID" cellpadding="6"
				autogeneratecolumns="False" BorderStyle="None" BorderWidth="0px" width="420px" showheader="false">
				<EmptyDataTemplate>
				You currently have no albums.
				</EmptyDataTemplate>
				<EmptyDataRowStyle CssClass="emptydata"></EmptyDataRowStyle>
				<columns>
					<asp:TemplateField>
						<ItemStyle Width="116" />
						<ItemTemplate>
							<table border="0" cellpadding="0" cellspacing="0" class="photo-frame">
								<tr>
									<td class="topx--"></td>
									<td class="top-x-"></td>
									<td class="top--x"></td>
								</tr>
								<tr>
									<td class="midx--"></td>
									<td><a href='Photos.aspx?AlbumID=<%# $this->Eval("AlbumID") %>'>
										<img src="../Handler.ashx?AlbumID=<%# $this->Eval("AlbumID") %>&Size=S" class="photo_198" style="border:4px solid white" alt="Sample Photo from Album Number <%# $this->Eval("AlbumID") %>" /></a></td>
									<td class="mid--x"></td>
								</tr>
								<tr>
									<td class="botx--"></td>
									<td class="bot-x-"></td>
									<td class="bot--x"></td>
								</tr>
							</table>
						</ItemTemplate>
					</asp:TemplateField>
					<asp:TemplateField>
						<ItemStyle Width="280" />
						<ItemTemplate>
							<div style="padding:8px 0;">
								<b><%# $this->Server->HtmlEncode($this->Eval("Caption")) %></b><br />
								<%# $this->Eval("Count") %> Photo(s)<asp:Label ID="Label1" Runat="server" Text=" Public" Visible='<%# $this->Eval("IsPublic") %>'></asp:Label>
							</div>
							<div style="width:100%;text-align:right;">
								<asp:ImageButton ID="ImageButton2" Runat="server" CommandName="Edit" SkinID="rename" />
								<a href='<%# "Photos.aspx?AlbumID=" . $this->Eval("AlbumID") %>'><asp:image ID="Image1" runat="Server"  skinid="edit" /></a>
								<asp:ImageButton ID="ImageButton3" Runat="server" CommandName="Delete" SkinID="delete" />
							</div>
						</ItemTemplate>
						<EditItemTemplate>
							<div style="padding:8px 0;">
								<asp:TextBox ID="TextBox2" Runat="server" Width="160" Text='<%# Bind("Caption") %>' CssClass="textfield" />
								<asp:CheckBox ID="CheckBox1" Runat="server" checked='<%# Bind("IsPublic") %>' text="Public" />
							</div>
							<div style="width:100%;text-align:right;">
								<asp:ImageButton ID="ImageButton4" Runat="server" CommandName="Update" SkinID="save" />
								<asp:ImageButton ID="ImageButton5" Runat="server" CommandName="Cancel" SkinID="cancel" />
							</div>
						</EditItemTemplate>
					</asp:TemplateField>
				</columns>
			</asp:gridview>
		</div>

	</div>
	
	<asp:ObjectDataSource ID="ObjectDataSource1" Runat="server" TypeName="PhotoManager" 
		SelectMethod="GetAlbums"
		InsertMethod="AddAlbum" 
		DeleteMethod="RemoveAlbum" 
		UpdateMethod="EditAlbum" >
	</asp:ObjectDataSource>

</asp:content>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Czech Republic Czech Republic
I live in Prague, the capital city of Czech republic (most of the time Smile | :) ). I've been very interested in functional programming recently and I have a passion for the new Microsoft F# language. I'm writing a book about Functional Programming in the Real World that shows the ideas using examples in C# 3.0 and F#.

I've been Microsoft MVP (for C#) since 2004 and I'm one of the most active members of the F# community. I'm a computer science student at Charles University of Prague. My hobbies include photography, fractals and of course many things related to computers (except fixing them). My favorite book writers are Terry Pratchett and Philip K Dick and I like paintings by M. C. Escher.

PS: My favorite codeproject icon is Sheep | [baah] .

Comments and Discussions