在 Internet Explorer 中显示 Smarty 模板时出现问题
我已将现有网站转换为 Smarty 模板(我的第一个项目,拥有 1 天的 smarty 经验)
在转换之前,我的网站在 IE 和 FF 中看起来不错。
转换后 FF 看起来仍然不错,但在 IE 中一切都崩溃了。 我尝试比较 IE 和 FF 中的源代码,一切看起来都完全相同。 任何帮助表示赞赏。
I have converted my existing website to Smarty template (my very first project with 1 day of smarty experience under the belt)
Prior to conversion my website looked fine in IE and FF.
After the conversion FF still looks okay however in IE everything falls apart.
I have tried comparing the source code in IE and FF and everything looks exactly the same.
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于 Smarty 只是生成发送到浏览器的 HTML 的模板系统,因此当您将现有网站拆分为多个部分时,可能会出现此问题。不幸的是,要找出 SO 上的完整项目出了什么问题并不容易。也就是说,这里有一些调试问题的技巧。
加载您的旧网站并从浏览器复制源代码(哪个浏览器都没关系,因为服务器发送相同的 HTML*)。
加载您的新站点并从浏览器复制源。
比较两个来源以找出差异。
我认为这是最好的起点。如果新站点向浏览器发送完全相同的 HTML,则似乎某些资源未加载(错误链接)或 javascript 未在 IE 中执行,而 IE 应该与 Smarty 分开。为此,请检查 IE 的开发人员工具,并确保没有 CSS 出现 404 错误并且没有抛出 js 异常。
*只要您不根据发送的用户代理修改服务器上的内容,这种情况并不常见。
Since Smarty is just the templating system that generates the HTML sent to the browser, the issue probably occurred when you split up your existing site into parts. Unfortunately it isn't very easy to find out what is wrong with a full project on SO. That said, here are some tips on debugging the issue.
Load your old site and copy the source from the browser (doesn't matter which browser as the server sends the same HTML*).
Load your new site and copy the source from the browser.
Diff the two sources to find the differences.
I think that's the best place to start. If the new site is sending the exact same HTML to the browser, then it would seem that some resource isn't being loaded (bad link) or javascript isn't being executed in IE, which should be separate from Smarty. For that check IE's Developer Tools and make sure no CSS is getting a 404 and no js exceptions are being thrown.
*As long as you aren't modifying things on the server based off the User-Agent sent, which is not common.