如何让fancybox与symfony框架一起工作?

时间:2011-09-18 10:55:25

标签: frameworks fancybox symfony-1.4

我正在使用symfony 1.4。我想请你帮忙用花式盒子。点击我的图片后如何制作这个精美的画廊。请。

我尝试过这样的事情: 在apps / fronted / config / viey.yml

javascripts:    [jquery-1.4.3.min.js, jquery.fancybox-1.3.4.js]

还将这些文件放在css文件夹web / js中

在apps / fronted / config / templates / layout.php中我留下它没有任何变化

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//PL" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
 <head>
        <?php include_http_metas() ?>
        <?php include_metas() ?>
        <?php include_title() ?>
        <?php include_stylesheets() ?>
        <?php include_javascripts() ?>
    </head>
    <body>
        <div id="container">
            <div class="content">
                <?php echo $sf_content ?>
            </div>
        </div>
    </body>

在apps / fronted / modules / myshop / templates / homeSuccess.php中写道

<a id="single_image" href="images/braceles/1.jpg">
<img src="images/braceles/1.jpg" alt=""/></a>

之后我点击图片,它将我重定向到带图像的页面而不是那个花哨的视图:(我不明白,那是什么“single_image”,我做错了什么? 请帮帮我,谢谢用户! :)

1 个答案:

答案 0 :(得分:0)

我使用的粉丝盒像: 在apps / fronted / config / view.yml

javascripts: [jquery-1.6.2.min.js,fancybox/jquery.fancybox-1.3.4.js,fancybox/jquery.easing-1.3.pack.js,fancybox/jquery.mousewheel-3.0.4.pack.js,fancybox/fancyconfig.js]
stylesheets:    [fancybox/jquery.fancybox-1.3.4.css]

在我的fancyconfig.js

   $(document).ready(function(){
   $("a#image_fancybox").fancybox({
                'titlePosition'     : 'over',
                'overlayOpacity'    : 0.4
            });

});

在我的 apps / fronted / modules / mymod / templates / indexSuccess.php

<a id="image_fancybox" title="<?php echo $project->getDescription()?>" href="<?php echo "/uploads/projects/".$project->getImage() ?>"> <img src="<?php echo "/uploads/projects/thumbnails/thumb_".$project->getImage() ?>" alt="<?php echo $project->getDescription() ?>"/></a>

所以,这是工作。您可以在firebug中使用firefox来调试js代码。