简体   繁体   中英

How do I include an ASP.NET file in a Magento PHP page?

Here is the situation: I have an ASP.NET main site, with a Magento buy-online section. The .NET site contains the header with menus generated dynamically, and I have to reuse the same header in the Magento side of the site.

I can't just copy the HTML in a static block, since the menu items are generated dynamically from a Database. I tried using an Iframe, but I'm using superfish for the menus, so when the sub-menus show up they don't fit in the iframe, so we don't see the whole menu. So I tried using the php include, with both the following syntaxes: include("/GetHeader.aspx?l=en"); and include("http://siteurl/GetHeader.aspx?l=en"); but both fail to show anything, the page is just blank.

My php.ini is set to show errors and warnings and both allow_url_fopen and allow_url_include are set to On

Any idea on how to achieve what I'm trying to do?

Thank you

I really don't think this is cleanly possible with a plain server stack. There might be something you could do if you have Varnish running using Edge Side Includes .

The PHP include function is meant for including files during compile time through the file system. This means it doesn't perform any HTTP request and therefore does not run through the ASP.NET engine. That's why it doesn't work in the way you are using it.

You could call the page directly using a web request like feature of PHP.

Since you have allow_url_fopen I believe you can do this:

print file_get_contents('http://siteurl/GetHeader.aspx?l=en');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM