情况如下:
我有一个 ASP.NET 主站点,其中有一个 Magento 在线购买部分。
.NET 站点包含带有动态生成的菜单的标头,我必须在站点的 Magento 端重用相同的标头。
我不能只复制静态块中的 HTML,因为菜单项是动态生成的
来自数据库。
我尝试使用 iframe,但我使用 superfish 作为菜单,因此当子菜单显示时,它们不适合 iframe,因此我们看不到整个菜单。
所以我尝试使用 php include,并使用以下语法:
包括(“/GetHeader.aspx?l = en”);
和
包括(“http://siteurl/GetHeader.aspx?l=en”);
但两者都没有显示任何内容,页面只是空白。
我的 php.ini 设置为显示错误和警告
allow_url_fopen 和allow_url_include 设置为On
关于如何实现我想要做的事情有什么想法吗?
谢谢
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
发布评论
评论(3)
我真的不认为这对于普通的服务器堆栈来说是完全可能的。如果您使用 Varnish,您可能可以做一些事情www.varnish-cache.org/docs/2.1/tutorial/esi.html" rel="nofollow">边缘侧包括。
PHP
include
函数用于在编译时通过文件系统包含文件。这意味着它不执行任何 HTTP 请求,因此不通过 ASP.NET 引擎运行。这就是为什么它不能按照您使用的方式工作。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.您可以使用 PHP 的类似 Web 请求的功能直接调用该页面。
You could call the page directly using a web request like feature of PHP.
既然你有
allow_url_fopen
我相信你可以这样做:Since you have
allow_url_fopen
I believe you can do this: