Drupal到flash资源的路径

Drupal到flash资源的路径,flash,drupal,Flash,Drupal,我有以下javascript在page.tpl.php中嵌入flash <script type="text/javascript"> <!-- var flashvars = { xmlUrl: "xml/banner.xml" //Use to

我有以下javascript在page.tpl.php中嵌入flash

                         <script type="text/javascript">
                            <!--
                            var flashvars = {
                                xmlUrl: "xml/banner.xml"    //Use to change XML filename or location
                            };
                            var params = {
                                scale: "noscale",
                                menu: "false",
                                bgcolor: "#666666"
                            };
                            var attributes = {
                                id: "banner_swf",
                                name: "banner_swf"
                            };
                            swfobject.embedSWF("banner.swf", "banner_div", "873", "300", "4", "swfobject/expressInstall.swf", flashvars, params, attributes);
                            //-->
                        </script>

问题是,现在该脚本中引用的所有xml和swf文件都位于我的“customtheme”目录中的“rotator”目录下。我应该如何更改路径

谢谢你的帮助!
Robert

要创建主题路径,您可以执行以下操作:

<?php $theme_path = $base_path . path_to_theme(); ?>
然后在js文件中可以得到该变量:

var path = Drupal.settings.myTheme.themePath;
要使事情成为真正的Drupal,您应该在一个行为中执行所有javascript,该行为在页面加载后执行:

Drupal.behaviors.myThemeAddFlash = function () {
  // Do your thing here
}

要创建主题的路径,可以执行以下操作:

<?php $theme_path = $base_path . path_to_theme(); ?>
然后在js文件中可以得到该变量:

var path = Drupal.settings.myTheme.themePath;
要使事情成为真正的Drupal,您应该在一个行为中执行所有javascript,该行为在页面加载后执行:

Drupal.behaviors.myThemeAddFlash = function () {
  // Do your thing here
}

我与flash作者进行了核对,他们要求我在var params中添加base:parameter,以指定可以在其中找到所有flash文件的基本文件夹。最后,以下是我在drupal中所做的工作

                            <script type="text/javascript">
                            <!--
                            var flashvars = {
                                //xmlUrl: "path/to/xml/filename.xml"    //Use to change XML filename or location
                            };
                            var params = {
                                base: "<?php print $base_path.$directory."/" ?>rotator/",
                                scale: "noscale",
                                menu: "false",
                                bgcolor: "#666666"
                            };
                            var attributes = {
                                id: "banner_swf",
                                name: "banner_swf"
                            };
                            swfobject.embedSWF("<?php print $base_path.$directory."/" ?>rotator/banner.swf", "banner_div", "876", "300", "4", "swfobject/expressInstall.swf", flashvars, params, attributes);
                            //-->
                        </script>

我与flash作者进行了核对,他们要求我在var params中添加base:parameter,以指定可以在其中找到所有flash文件的基本文件夹。最后,以下是我在drupal中所做的工作

                            <script type="text/javascript">
                            <!--
                            var flashvars = {
                                //xmlUrl: "path/to/xml/filename.xml"    //Use to change XML filename or location
                            };
                            var params = {
                                base: "<?php print $base_path.$directory."/" ?>rotator/",
                                scale: "noscale",
                                menu: "false",
                                bgcolor: "#666666"
                            };
                            var attributes = {
                                id: "banner_swf",
                                name: "banner_swf"
                            };
                            swfobject.embedSWF("<?php print $base_path.$directory."/" ?>rotator/banner.swf", "banner_div", "876", "300", "4", "swfobject/expressInstall.swf", flashvars, params, attributes);
                            //-->
                        </script>


谢谢您的帮助!我已经成功了,但还没有这样尝试过。谢谢谢谢你的帮助!我已经成功了,但还没有这样尝试过。谢谢