SWF Tools dentro il template.php / node.tpl.php

11 contenuti / 0 new
Ultimo contenuto
SWF Tools dentro il template.php / node.tpl.php

Salve a tutti,
sto cercando disperatamente di inserire un file SWF nella pagina page.tpl.php del mio tema.
Ho fatto due tentativi, il primo utilizzando SWF TOOLS e inserendo nella pagina il codice
<?php print swf("/titolo.swf", "960x200"); ?>

il secondo utilizzando il modulo swfobject_api ed utilizzando

<?php
case 'page':
 
$vars['swf_logo'] = swf(
   
"<a href="http://example.com/files/banner.swf",
" rel="nofollow">http://example.com/files/banner.swf",
</
a>    array('width' => '526', 'height' => '58', 'bgcolor' => '#001647'), FALSE,
    array(
'html_alt' => '<h1>Name of site if flash is disabled.</h1>')
  );
?>
.

Ho verificato e riverificato il codice utilizzado seguendo le varie guide dei moduli, ho inserito il mio file SWF nella cartella FILES come richiesto, ma niente da fare... nella pagina compare solo il box dove dovrebbe esserci il filmato ma non si vede nulla. Cliccando sopra con il tasto DX del mouse compare la scritta FILMATO NON CARICATO.

Qualcuno ha qualche suggerimento?

non ho mai inserito swf nel page.tpl.php, ma sono comunque interessato. Hai qualche link per le guide? Come hai inserito swf_tools o swfobject_api?

in che senso?

Quote:
Come hai inserito swf_tools o swfobject_api?

ho semplicemente abilitato i due moduli reperibili a questi indirizzi:
http://drupal.org/project/swfobject_api
http://drupal.org/project/swftools

Per swftools ho inserito il codice <?php print swf("nomefile.swf", "960x200"); ?> nel file page.tpl.php mentre per swfobject ho
inserito:

<?php
   $url
= "files/titolo.swf"; //path to flash file
  
$params = array('width' => 960, 'height' => 200 );
   print
theme("swfobject_api", $url, $params);
?>

Ho provato anche assegnando la variabile
$vars['swf_logo'] = swf("http://ww.assofilm.org/files/titolo.swf", array('width' => '960', 'height' => '200', 'bgcolor' => '#001647'), FALSE, array('html_alt' => '<h1>Filmato non caricato.</h1>'));
nel file template.tpl.php e la striga

<?php
print $swf_logo
?>

nel file page.tpl.php (come sulla guida: http://drupal.org/node/181591) ma senza ottenere alcun risultato.

In parole semplici devo inserire un filmato flash nel header del sito, in modo che compaia in tutte le pagine.
P.S. neanche inserendo il filmato in un nodo mi funziona.

SONO DISPERATO

Se usi garland prova ad inserire questo altrimenti inserisci il codice di swf_logo dentro l'if

<?php
function _phptemplate_variables($hook, $vars) {
  if (
$hook == 'page') {
    if (
$secondary = menu_secondary_local_tasks()) {
     
$output = '<span class="clear"></span>';
     
$output .= "<ul class="tabs secondary">\n". $secondary ."</ul>\n";
     
$vars['tabs2'] = $output;
    }
   
// Hook into color.module
   
if (module_exists('color')) {
     
_color_page_alter($vars);
    }
   if (
module_exists('swftools')) {
     
$vars['swf_logo'] = swf(
       
"<a href="http://example.com/files/banner.swf",
" rel="nofollow">http://example.com/files/banner.swf",
</
a>         array('width' => '526', 'height' => '58', 'bgcolor' => '#001647'), FALSE,
         array(
'html_alt' => '<h1>Name of site if flash is disabled.</h1>')
      );
   }
    return
$vars;
  }
  return array();
}
?>

devi metterlo nel template.php. Il tuo codice nel template.php manca di un pezzo.

niente da fare.....
al momento utilizzo il tema SKY.

se vuoi vedere, il sito e' www.assofilm.org

non capisco proprio cosa non vada... ho provato anche a fare come mi hai detto tu ma non cambia nulla

posta il codice del template.php dove hai inserito il mio codice e quello del node.tpl.php

EDIT: guarda un pò qui.
http://www.assofilm.org/files/titolo.swf

Internal Server Error

Usi aruba? Prova a togliere .htaccess o inserire quello nelle faq

il codice di template.php e':

<?php
function sky_regions() {
  return array(
      
'header' => t('header'),
      
'left' => t('sidebar left'),
      
'right' => t('sidebar right'),
      
'contenttop' => t('content top'),
      
'contentbottom' => t('content bottom'),
      
'contentfooter' => t('content footer'),
      
'footer' => t('footer')
  );
}
function
phptemplate_links($links, $attributes = array('class' => 'links')) {
          
$output = '';
           if (
count($links) > 0) {
            
$output = '<ul'. drupal_attributes($attributes) .'>';
            
$num_links = count($links);
            
$i = 1;
             foreach (
$links as $key => $link) {
              
$class = '';
              
// Automatically add a class to each link and also to each LI
              
if (isset($link['attributes']) && isset($link['attributes']['class'])) {
                
$link['attributes']['class'] .= ' ' . $key;
                
$class = $key;
               }
               else {
                
$link['attributes']['class'] = $key;
                
$class = $key;
               }
              
// Add first and last classes to the list of links to help out themers.
              
$extra_class = '';
               if (
$i == 1) {
                
$extra_class .= 'first ';
               }
               if (
$i == $num_links) {
                
$extra_class .= 'last ';
               }
              
$output .= '<li class="'. $extra_class . $class .'">';
              
// Is the title HTML?
              
$html = isset($link['html']) && $link['html'];
              
// Initialize fragment and query variables.
              
$link['query'] = isset($link['query']) ? $link['query'] : NULL;
              
$link['fragment'] = isset($link['fragment']) ? $link['fragment'] : NULL;
               if (isset(
$link['href'])) {
                
$output .= l('<span>' . $link['title'] . '</span>', $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, TRUE);
               }
               else if (
$link['title']) {
                
//Some links are actually not links, but we wrap these in <span> for adding title and class attributes
                
if (!$html) {
                  
$link['title'] = check_plain($link['title']);
                 }
                
$output .= '<span'. drupal_attributes($link['attributes']) .'>'. $link['title'] .'</span>';
               }
              
$i++;
              
$output .= "</li>\n";
             }
            
$output .= '</ul>';
           }
           return
$output;
         }
function
_phptemplate_variables($hook, $vars = array()) {
  switch (
$hook) {
    case
'page':
     
$vars['body_class'] = '';
     
$layout = '';
     
//Is there a left sidebar?
     
if ($vars['sidebar_left'] != '') {
         
$layout = 'sidebar-left';
      }
     
//Is there a right sidebar?
     
if ($vars['sidebar_right'] != '') {
          
$layout = ($layout == 'sidebar-left') ? 'sidebars' : 'sidebar-right';
      }
     
//Put layout into body_class
     
if ($layout != ''){
        
$vars['body_class'] .= ' ' . $layout;
      }
         if (
module_exists('swftools')) {
     
$vars['swf_logo'] = swf(
       
"<a href="http://www.assofilm.org/files/titolo.swf",
" rel="nofollow">http://www.assofilm.org/files/titolo.swf",
</
a>         array('width' => '960', 'height' => '200', 'bgcolor' => '#001647'), FALSE,
         array(
'html_alt' => '<h1>Name of site if flash is disabled.</h1>')
      );
   }
      break;
  }
  return
$vars;
}
?>

quello di page.tpl.php e':

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language; ?>" xml:lang="<?php print $language; ?>">
<head>
<title><?php print $head_title; ?></title>
<?php print $head; ?><?php print $styles; ?><?php print $scripts; ?>
<script type="text/javascript"><?php /* Needed to avoid Flash of Unstyle Content in IE */ ?> </script>
</head>
<body class="<?php print $layout; ?>">
<div id="wrapper">
  <?php if($is_front) { //  if we are on the homepage, print the slogan ?>
    <?php if ($site_slogan):?>
    <span class="header_title"><?php print $site_slogan; ?></span>
    <?php endif; ?>
  <?php } else { // otherwise print the page title ?>
  <span class="header_title"></span>
  <?php } ?>
  <div id="header">
<?php print $swf_logo ?>
    <div class="navigation">
      <?php print theme('links', $primary_links); ?>
    </div>
  </div>
  <div class="container">
    <div id="page" class="<?php print "page-" . $node->type; ?>">
      <?php if ($secondary_links): ?>
      <div class="secondary_links"> <?php print theme('links', $secondary_links); ?></div>
      <?php endif; ?>
      <div id="content">
        <?php if ($breadcrumb): ?>
        <?php print $breadcrumb; ?>
        <?php endif; ?>
        <?php if ($messages): ?>
        <?php print $messages; ?>
        <?php endif; ?>
        <?php if ($is_front && $mission): ?>
        <div class="mission"><?php print $mission; ?></div>
        <?php endif; ?>
        <?php if ($contenttop): ?>
        <div id="content_top"><?php print $contenttop; ?></div>
        <?php endif; ?>
        <?php if ($title): ?>
        <h1 class="title"><?php print $title; ?></h1>
        <?php endif; ?>
        <?php if ($help): ?>
        <div class="help"><?php print $help; ?></div>
        <?php endif; ?>
        <?php if ($tabs): ?>
        <?php print $tabs; ?>
        <?php endif; ?>
        <?php print $content; ?>
        <?php if ($contentbottom): ?>
        <div id="content_bottom"><?php print $contentbottom; ?></div>
        <?php endif; ?>
      </div>
    </div>
    <div id="sidebar">
    <?php if ($sidebar_left): ?>
    <div class="left"><?php print $sidebar_left; ?></div>
    <?php endif; ?>
<?php if ($sidebar_right): ?>
    <div class="right"><?php print $sidebar_right; ?></div>
    <?php endif; ?>
    </div>
  </div>
  <div class="push">&nbsp;</div>
</div>
<div id="footer"><?php print $contentfooter; ?>
  <?php if ($footer_message): ?>
  <?php print $footer_message; ?>
  <?php endif; ?>
</div>
<?php print $closure; ?>
</body>
</html>

p.s. sto usando drupal 5.3

Leggi il mio ultimo commento ;)

se tu non fossi un uomo ti bacerei...
sentivo che era una ca***ta ma del .htaccess non mi sarebbe mai venuto in mente...

grazie mille veramente!!

figurati ;)