Search code examples
phpasp.net-mvcfile-managerphalanger

ASP.NET PHP View: using Phalanger for only one page


QUESTION

Is it possible to use Phalanger (https://phalanger.codeplex.com/) in ASP.NET MVC for just one view and leave everything else using the normal Razor View Engine?

SITUATION

I am currently using ELFinder in my site which I integrated using the ELFinder Connector for .NET.

Ideally, I would like to integrate the Responsive File Manager, here: http://www.responsivefilemanager.com/index.php

Unfortunately, the aforementioned file manager is written for PHP.

I have read that PHP can be used within MVC using Phalanger (see: http://www.infoq.com/articles/Phalanger)

And I am wondering whether it is at possible to create a PHP view and make this file manager work for my site while at the same time leaving all other pages alone.

Note, I know nothing of PHP at all...

If this is at all possible, how would I go about starting to do this?

EDIT

I found a simple implementation of an MVC PHP View Engine here (which is based on Phalanger): https://phpviewengine.codeplex.com/

I seem to have sort of got it working with TinyMCE. It actually shows up quite nicely, but then when trying to select a file, it throws various JavaScript errors. Here is a link to the demo project I made:

http://www.mediafire.com/download/p418f8xp7t9kiz3/PhpMvc.zip

Any geniuses out there who can figure this one out?

EDIT 2

The reason it was working when it shouldn't have been is I was silly enough to have the TinyMCE config point to the author's server.. as follows:

external_filemanager_path:"http://test.albertoperipolli.com/secondaryserver/filemanager/",
external_plugins: { "filemanager" : "http://test.albertoperipolli.com/secondaryserver/filemanager/plugin.min.js"},

Now when I actually correct that to point to my local installation, I have the following error:

"The page you are requesting cannot be served because of the extension configuration"

I guess I need to tell IIS / IIS Express how to deal with PHP files. Now looking at this: https://support.microsoft.com/en-us/kb/2819022

EDIT 3

Thanks, @Jakub Míšek for the tip. I did get a bit further - I upgraded to Phalanger 4 as advised and also updated to MVC5 while I was at it. It seems the code is being run, but still not successfully. When I try to browse, there is an exception thrown in the config.php file as follows:

An exception of type 'PHP.Core.PhpException' occurred in PhpNetCore.dll but was not handled in user code

Additional information: Call to undefined function: 'session_start'

This is being thrown at the first line of code, which is:

session_start();

If I comment that out and continue, the next line also throws the same exception.

I've heard that entire frameworks, such as Prado can be run on Phalanger. so i guess I am still doing something wrong here.

I have uploaded my latest attempt to: http://www.mediafire.com/download/2jz85y17znmtlz6/PhpMvc5.zip

Would appreciate it if anyone can provide working example. I will even start a bounty for a large number of points when allowed to and reward it to whoever can give the best answer... as having this file manager in ASP.NET would indeed be awesome.

EDIT 4

I am making some pretty good progress now, having worked out a few issues... see screenshot below for current status. I even have it where I am using ONLY .cshtml files (the PHP files being called by the file manager are simply being processed by the PHP View Engine), so this is really, really fantastic. It seems I have some more issues to deal with.. if I manage to get it working properly, I will post the solution here for the benefit of others.

enter image description here


Solution

  • I solved this. For those who are interested, see my article on CodeProject: http://www.codeproject.com/Tips/1004596/Using-Responsive-File-Manager-in-ASP-NET-MVC