C# and php code in one website
5 posts
• Page 1 of 1
C# and php code in one website
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.
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
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).
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
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
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"?
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
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
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
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 58 guests