Php symfony1.3.6-javascript弹出窗口windw-how?

Php symfony1.3.6-javascript弹出窗口windw-how?,php,javascript,symfony1,symfony-1.4,Php,Javascript,Symfony1,Symfony 1.4,我正在使用SF1.3.6。我有一些静态文本文件(HTML),我希望能够在弹出窗口中显示 我试过这个: <a href="javascript:showPopup('foobar.html', 'all about foobar')">foobar</a><br /> <script type="text/javascript"> function showPopup(url, title) { window.open(url,title,"me

我正在使用SF1.3.6。我有一些静态文本文件(HTML),我希望能够在弹出窗口中显示

我试过这个:

<a href="javascript:showPopup('foobar.html', 'all about foobar')">foobar</a><br />

<script type="text/javascript">
function showPopup(url, title) {  window.open(url,title,"menubar=no,width=430,height=360,toolbar=no");} 
</script>

函数showPopup(url,标题){window.open(url,标题,“菜单栏=否,宽度=430,高度=360,工具栏=否”);}
当我点击链接时,我得到一个SF404异常。我怎样才能解决这个问题

注意:我真的不想为这些静态文件编写路由、操作和模板——有没有其他方法用SF实现弹出窗口

[编辑]

这是我的原始.htaccess内容

<IfModule mod_rewrite.c>
  RewriteEngine On

  #force everything to www so URLs look the same
  RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

  # uncomment the following line, if you are having trouble
  # getting no_script_name to work
  #RewriteBase /

  # we skip all files with .something
  #RewriteCond %{REQUEST_URI} \..+$
  #RewriteCond %{REQUEST_URI} !\.html$
  #RewriteRule .* - [L]

  #redirect on trailing slash (otherwise, Symfony will 404)
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)/$ /$1 [R=302,L]

  # we check if the .html version is here (caching)
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

重新启动发动机
#强制所有内容访问www,使url看起来相同
RewriteCond%{HTTP_HOST}^example\.com$[NC]
重写规则^(.*)$http://www.example.com/$1[R=301,L]
#如果遇到问题,请取消对以下行的注释
#无法使用脚本名称
#重写基/
#我们跳过了所有的文件
#重写条件%{REQUEST_URI}\+$
#重写条件%{REQUEST\u URI}!\。html$
#重写规则。*-[L]
#在尾部斜杠上重定向(否则,Symfony将为404)
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)/$/$1[R=302,L]
#我们检查.html版本是否在这里(缓存)
重写规则^$index.html[QSA]
重写规则^([^.]+)$$1.html[QSA]
重写cond%{REQUEST_FILENAME}-F
#不,所以我们重定向到前端web控制器
重写规则^(.*)$index.php[QSA,L]
我用杰里米的剧本代替了它。然后我重新启动了Apache,但我得到了相同的错误

404 |未找到| SFERROR404异常 之后清空模块和/或操作 正在分析URL“/foobar.html”(/)


默认的Symfony.htaccess文件应该有一行来服务web目录中已经存在的文件。确保为文件指定的路径存在于web中。以下是.htaccess中的相关行:

# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
这是我的完整.htaccess,还有一些其他改进:

<IfModule mod_rewrite.c>
  RewriteEngine On

  #force everything to www so URLs look the same
  RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

  # uncomment the following line, if you are having trouble
  # getting no_script_name to work
  #RewriteBase /

  # we skip all files with .something
  #RewriteCond %{REQUEST_URI} \..+$
  #RewriteCond %{REQUEST_URI} !\.html$
  #RewriteRule .* - [L]

  #redirect on trailing slash (otherwise, Symfony will 404)
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)/$ /$1 [R=302,L]

  # we check if the .html version is here (caching)
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

重新启动发动机
#强制所有内容访问www,使url看起来相同
RewriteCond%{HTTP_HOST}^example\.com$[NC]
重写规则^(.*)$http://www.example.com/$1[R=301,L]
#如果遇到问题,请取消对以下行的注释
#无法使用脚本名称
#重写基/
#我们跳过了所有的文件
#重写条件%{REQUEST_URI}\+$
#重写条件%{REQUEST\u URI}!\。html$
#重写规则。*-[L]
#在尾部斜杠上重定向(否则,Symfony将为404)
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)/$/$1[R=302,L]
#我们检查.html版本是否在这里(缓存)
重写规则^$index.html[QSA]
重写规则^([^.]+)$$1.html[QSA]
重写cond%{REQUEST_FILENAME}-F
#不,所以我们重定向到前端web控制器
重写规则^(.*)$index.php[QSA,L]

您将静态文件存储在哪里?要使用/foobar.html访问它们,您需要将它们放在web/目录中

另外,请记住让web服务器能够读取它们。

尝试在foobar.html中添加一个前导“/”

javascript:showPopup('/foobar.html', 'all about foobar')

如果您在开发环境中,那么调用foobar.html实际上就是调用
frontend\u dev.php/foobar.html
。添加前导“/”将去掉前端的_dev.php。

foobar.html是否位于web文件夹的顶层?是的,文件位置类似于:web/foobar.htmlHi Kuba:我的文件位于web文件夹中,所有人都可以读取(模式:644)。我不会说这是symfony问题,也不会说是.htaccess问题。我刚刚在vanilla symfony项目上用default.htaccess对它进行了测试,它很简单(Permissions 644)。您是否已将主机配置为symfony文档中的Advised?