C# and php code in one website

Discussion about the open-source Phalanger [?] project.

C# and php code in one website

Postby schlaefisch@codeplex » April 11th, 2007, 3:33 pm

Hi,
I have an website containing aspx (c#) pages as well as php pages. Atm asp.net and php are running independently. Layout, user administration etc. are realized in asp.net and in php.

Can anyone tell me how integrate php in an existing asp.net website? If possible I would like to have only one asp.net project containing all c# and php files, using the same masterpage etc. I looked at the samples, but found no project which mixed languages within a single webproject.
schlaefisch@codeplex
 
Posts: 3
Joined: January 7th, 2012, 8:54 pm

RE: C# and php code in one website

Postby tomasp » April 17th, 2007, 12:33 am

Hi,
To use masterpage (and other ASP.NET 2.0) features, you'll need to modify the PHP sources to match ASP.NET programming style. If this is what you're trying to do, than you should take a look at Personal WebSite starter kit (download the VSI file and open it). The sample contains only "page.aspx" + "page.aspx.php" code, but if you add "page2.aspx" + "page2.aspx.cs" in C#, it will work without any difficulties.

(VSI can be found here:http://www.codeplex.com/Phalanger/Release/ProjectReleases.aspx).
tomasp
 
Posts: 46
Joined: January 7th, 2012, 8:37 pm

RE: C# and php code in one website

Postby schlaefisch@codeplex » April 17th, 2007, 10:34 pm

Don't think this will work for me. Was hoping for something like an UserControl dynamically loading and executing php code. Would have been to nice ;)
schlaefisch@codeplex
 
Posts: 3
Joined: January 7th, 2012, 8:54 pm

RE: C# and php code in one website

Postby toncho@codeplex » April 17th, 2007, 11:12 pm

I want to use master pages and I am doing something like that:

This is my test.aspx:

<%@ Page Language="PHP" MasterPageFile="~/User/MasterPage.master" AutoEventWireup="true" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<?php
echo "Hello World";

echo "This spans
multiple lines. The newlines will be
output as well";

?>
</asp:Content>

Why it is not working? I do not see "hello world"?
toncho@codeplex
 
Posts: 5
Joined: January 7th, 2012, 8:55 pm

RE: C# and php code in one website

Postby tomasp » April 18th, 2007, 1:13 am

Hi,
the issue here is that the ASPX file is processed by ASP.NET and not Phalanger. You can however include PHP script in the page, but you need to use ASP.NET tags for including it:

<%@ Page Language="PHP" MasterPageFile="~/User/MasterPage.master" AutoEventWireup="true" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<%
echo "Hello World";
%>
</asp:Content>

>> Was hoping for something like an UserControl dynamically loading and executing php code. Would have been to nice ;)
Hmm, I see.. this sounds like an reasonable request, and it would be very useful indeed.
I'll see whatwe could do about it!

Thanks,
Tomas
tomasp
 
Posts: 46
Joined: January 7th, 2012, 8:37 pm


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 58 guests

User Control Panel

Login

Who is online

In total there are 58 users online :: 0 registered, 0 hidden and 58 guests (based on users active over the past 5 minutes)
Most users ever online was 480 on April 27th, 2024, 5:51 am

Users browsing this forum: No registered users and 58 guests