Pagina 3 di 3 primaprima 1 2 3
Visualizzazione dei risultati da 21 a 30 su 30
  1. #21
    Utente di HTML.it
    Registrato dal
    Nov 2014
    Messaggi
    17
    Si ma come adatti il tutto al mio problema? La soluzione di camionistaxcaso mi sembra perfetta, bisogna soltanto modificare qualcosa...

  2. #22
    Quote Originariamente inviata da ninni87 Visualizza il messaggio
    Questo e' il codice completo:
    codice:
    <?php
    if(isset($_POST["action"]) and $_POST["action"] == "go")
    {
       $filename="file.xls";
       header ("Content-type:application/vnd.ms-excel");
       header ("Content-Disposition: attachment; filename=$filename");
    }
    ?>
    
    <?php
    
    defined('_JEXEC') or die('Restricted access');
    
    
    $mainframe = JFactory::getApplication();
    $pathway  = & $mainframe->getPathWay();
    $pathway->addItem($this->data->dmname);
    
    JFactory::getDocument()->setTitle( _DML_TPL_TITLE_DETAILS . ' | ' . $this->data->dmname );
    ?>
    
    <div id="dm_details" class="<?php echo @$this->theme->conf->style ? 'dm_dark' : 'dm_light'; ?>">
    
    
    <h1 class="dm_title"><?php echo _DML_TPL_DETAILSFOR ?><em>&nbsp;<?php echo htmlspecialchars($this->data->dmname) ?></em></h1>
    
    <?php
    if ($this->data->dmthumbnail) :
        ?><img src="<?php echo $this->paths->thumb ?>" alt="<?php echo htmlspecialchars($this->data->dmname)?>" /><?php
    endif;
    ?>
    
    <table summary="<?php echo htmlspecialchars($this->data->dmname)?>" cellspacing="0" >
    
    <col id="prop" />
    <col id="val" />
    <thead>
        <tr>
            <td><?php echo _DML_PROPERTY?></td><td><?php echo _DML_VALUE?></td>
        </tr>
    </thead>
    <tbody>
    <?php
    if($this->theme->conf->details_name) :
        ?>
        <tr>
             <td><strong><?php echo _DML_TPL_NAME ?>:</strong></td><td><?php echo htmlspecialchars($this->data->dmname) ?></td>
         </tr>
        <?php
    endif;
    
    if($this->theme->conf->details_name) :
        ?>
         <tr>
             <td><strong><?php echo _DML_TPL_AFF ?>:</strong></td><td><?php echo $this->data->dmaff ?></td>
         </tr>
        <?php
    endif;
    
    if($this->theme->conf->details_name) :
        ?>
         <tr>
             <td><strong><?php echo _DML_TPL_IC ?>:</strong></td><td><?php echo $this->data->dmic ?></td>
         </tr>
        <?php
    endif;
    
    
    
    if($this->theme->conf->details_name) :
        ?>
         <tr>
             <td><strong><?php echo _DML_TPL_AGG ?>:</strong></td><td><?php echo $this->data->dmagg ?></td>
         </tr>
        <?php
    endif;
    
    if($this->theme->conf->details_downloads) :
        ?>
    
         <tr>
             <td><strong><?php echo _DML_TPL_LASTUP ?>:</strong></td>
             <td>
                 <?php  $this->plugin('dateformat', $this->data->dmlastupdateon , _DML_TPL_DATEFORMAT_LONG); ?>
             </td>
         </tr>
        <?php
    endif;
    ?>
    </tbody>
    </table>
    <div class="clr"></div>
    </div>
    
    <?php if(JRequest::getString('tmpl') != 'component') :?>
        <div class="dm_taskbar <?php echo @$this->theme->conf->style ? 'dm_dark' : 'dm_light'; ?>">
        <ul>
        <?php
            unset($this->buttons['details']);
            $this->doc = &$this;
            include $this->loadTemplate('documents'.DS.'tasks.tpl.php');
        ?>
        <li><a href="javascript: history.go(-1);"><?php echo _DML_TPL_BACK ?></a></li>
        </ul>
        </div>
    
    <?php endif; ?>
    <div class="clr"></div>
    </table>
    </body></html>
    
    <form action="?">
    <input type="hidden" value="go" name="action">
    <input type="submit" value="Scarica in formato xls">
    </form>
    Ma c'e' qualcosa che non funziona..
    Ma ti da un errore?

  3. #23
    Utente di HTML.it
    Registrato dal
    Nov 2014
    Messaggi
    17
    No..nessun errore... ma non converte nulla. Cosa dovrei modificare?

  4. #24
    E se metti un exit cosi?

    codice:
    <?php
    if(isset($_POST["action"]) and $_POST["action"] == "go"){
       $filename="file.xls";
       header ("Content-type:application/vnd.ms-excel");
       header ("Content-Disposition: attachment; filename=$filename");
       exit;
    }
    
    ?>
    <table summary="<?php echo htmlspecialchars($this->data->dmname)?>" cellspacing="0" >
    <?php
    if($this->theme->conf->details_name) :
    ?>
    <tr>
    <td>
      <strong>
       <?php echo _DML_TPL_NAME ?>:
      </strong>
     </td>
    
     <td>
      <?php echo htmlspecialchars($this->data->dmname) ?>
     </td>
    </tr>
    
    <?php
    endif;if($this->theme->conf->details_name) :
    ?>
    <tr>
     <td>
      <strong>
       <?php echo _DML_TPL_CIG ?>:</strong>
     </td>
     <td>
      <?php echo $this->data->dmcig ?>
     </td>
    </tr>
    
    <?php
    endif;
    
    if($this->theme->conf->details_name) :
    ?>
    <tr>
      <td>
       <strong><?php echo _DML_TPL_SOG ?>:</strong>
      </td>
      <td><?php echo $this->data->dmsog ?></td>
    </tr>
    
    <?php
    endif; 
    ?>
    </tbody>
    </table> 
    <form action="?">
    <input type="hidden" value="go" name="action">
    <input type="submit" value="Scarica in formato xls">
    </form>

  5. #25
    Utente di HTML.it
    Registrato dal
    Nov 2014
    Messaggi
    17
    Niente non mi converte nulla.

  6. #26
    Utente di HTML.it
    Registrato dal
    Nov 2014
    Messaggi
    17
    Ragazzi ma perche' cosi' mi converte tutta la pagina e non solo la tabella? Io non capisco dove sbaglio
    codice:
    <?php
    // nome del file che creeremo
    $filename="prova.xls";
    header ("Content-Type: application/vnd.ms-excel");
    header ("Content-Disposition: attachment; filename=$filename");?>
    
    <table summary="<?php echo htmlspecialchars($this->data->dmname)?>" cellspacing="0" >
    
    if($this->theme->conf->details_name) :    ?>
    <tr><td><strong><?php echo _DML_TPL_NAME ?>:</strong></td><td><?php echo htmlspecialchars($this->data->dmname) ?></td></tr>
    <?php endif;
    
    if($this->theme->conf->details_name) :  ?>
    <tr><td><strong><?php echo _DML_TPL_PROT ?>:</strong></td><td><?php echo $this->data->dmprot ?></td></tr><?php endif;
    
    if($this->theme->conf->details_downloads) : ?>
    <tr><td><strong><?php echo _DML_TPL_LASTUP ?>:</strong></td><td><?php  $this->plugin('dateformat', $this->data->dmlastupdateon , _DML_TPL_DATEFORMAT_LONG); ?></td></tr><?php endif;
    ?></tbody></table>
    
    <div class="clr"></div>
    </div>
    
    <?php if(JRequest::getString('tmpl') != 'component') :?>
        <div class="dm_taskbar <?php echo @$this->theme->conf->style ? 'dm_dark' : 'dm_light'; ?>">
        <ul>
        <?php
            unset($this->buttons['details']);
            $this->doc = &$this;
            include $this->loadTemplate('documents'.DS.'tasks.tpl.php');
        ?>
        <li><a href="javascript: history.go(-1);"><?php echo _DML_TPL_BACK ?></a></li>
        </ul>
        </div>
    <?php endif; ?>
    <div class="clr"></div>
    </table>
    </body></html>

  7. #27
    Ripeto, anche a me dava quel problema li. Tentavo di scaricare un file pdf con le funzioni header e il risultato del file scaricato era il file stesso + il contenuto della pagina, avevo risolto semplicemente mettendo

    if isset $_GET["var"] -> esegui il download

    else -> mostra il contenuto della pagina

    La differenza tra te e me è che tu il file lo crei, io invece lo avevo già pronto da scaricare. Potrebbe essere li l' inghippo?

  8. #28
    Quote Originariamente inviata da ninni87 Visualizza il messaggio
    Ragazzi ma perche' cosi' mi converte tutta la pagina e non solo la tabella? Io non capisco dove sbaglio
    Perchè l'output echo table etcc e gli header vanno in un file esterno a se stante !
    Ciao

  9. #29
    Quote Originariamente inviata da StefanoC Visualizza il messaggio
    Perchè l'output echo table etcc e gli header vanno in un file esterno a se stante !
    Ciao
    Ma infatti è un mese che glielo sono a dire di fare una pagina con solo la tabella
    Secondo me lui dovrebbe fare un' altra pagina con solo la tabella, raggiungibile dal pulsante "Scarica in formato xls".

  10. #30
    Utente di HTML.it
    Registrato dal
    Nov 2014
    Messaggi
    17
    Ciao ragazzi per la conversione in csv e xls ho risolto con ExcellentExport di javascript:

    <a download="<?php echo $nome; ?>.xls" href="#" onclick="return ExcellentExport.excel(this, 'table', 'Sheet Name Here');">
    <button>EXCEL</button></a></li>

    Ma per convertire questa tabella in xml?? Esistono delle estensioni? Dovrei fare la stessa identica cosa: creare un pulsante per estrarre un file xml...Ho letto di SimpleXML o DOM XML...
    Grazie

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.