Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Problema con smarty

  1. #1

    Problema con smarty

    ieri ho installato smarty sulla mia linuxbox.
    ho scompattato la sottodirectory libs dentro a /usr/lib/php/.
    dentro la root del sito ho creato la directory smarty e dentro questa le seguenti 4 directory:
    -templates
    -cache
    -configs
    -templates_c
    ho assegnato i permessi 775 e creato questi due file:
    Codice PHP:
    <?php

    require('/usr/lib/php/libs/Smarty.class.php');
    $smarty = new Smarty();

    $smarty->setTemplateDir('smarty/templates');
    $smarty->setCompileDir('smarty/templates_c');
    $smarty->setCacheDir('smarty/cache');
    $smarty->setConfigDir('smarty/configs');

    $smarty->assign('name''Prova');
    $smarty->display('template.tpl');
    ?>
    template.tpl
    Codice PHP:
    <html>
      <
    head>
        <
    title>Smarty</title>
      </
    head>
      <
    body>
        
    Hello, {$name}!
      </
    body>
    </
    html
    riavviato il pc e provato ad andare sulla pagina php.
    ma nn ottengo risultati.
    dove sbaglio??

  2. #2
    ho provato a spostare il tpl dentro a templates e a spostare tutte le cartelle direttamente dentro la root del sito.
    poi ho fatto queste modifiche:
    Codice PHP:
    <?php

    require_once '/usr/lib/php/libs/Smarty.class.php';
    $smarty = new Smarty();

    $smarty->template_dir('/srv/http/Banca/templates');
    $smarty->compile_dir('/srv/http/Banca/templates_c');
    $smarty->cache_dir('/srv/http/Banca/cache');
    $smarty->config_dir('/srv/http/Banca/configs');

    $smarty->assign('name''Prova');
    $smarty->display('template.tpl');
    $smarty->debugging TRUE;
    ?>
    nada de nada.
    vi posto i permessi:
    codice:
    # ls -l /srv/http/Banca
    totale 40
    drwxrwxr-x 2 http http  4096 24 gen 17.43 cache
    -rwxrwxr-x 1 casa users  293 24 gen 17.43 config.php
    drwxrwxr-x 2 casa users 4096 24 gen 17.43 configs
    drwxrwxr-x 2 casa users 4096 28 lug 19.15 css
    drwxrwxr-x 2 casa users 4096 28 lug 15.46 images
    -rwxrwxr-x 1 casa users  859 24 gen 17.43 index.php
    drwxrwxr-x 2 casa users 4096  7 gen 19.34 old
    -rwxrwxr-x 1 casa users  380 24 gen 17.48 smartytest.php
    drwxrwxr-x 2 casa users 4096 24 gen 17.43 templates
    drwxrwxr-x 2 http http  4096 24 gen 17.43 templates_c
    qualche idea??

  3. #3
    ho riprovato col setup avanzato ma ancora nulla:
    Codice PHP:
    <?php

    require '/usr/local/lib/smarty306/libs/Smarty.class.php';

    class 
    Smarty_Banca extends Smarty {

        function 
    __construct() {

            
    parent::__construct();

            
    $this->template_dir 'templates/';
            
    $this->compile_dir 'templates_c/';
            
    $this->config_dir 'configs/';
            
    $this->cache_dir 'cache/';

            
    $this->caching Smarty::CACHING_LIFETIME_CURRENT;
            
    $this->assign('app_name''Banca');
        }

    }
    Codice PHP:
    <?php

    require('setup.php');

    $smarty = new Smarty_Banca();

    $smarty->assign('name','Smarty prova');

    $smarty->display('index.tpl');
    ?>
    e poi ho messo index.tpl dentro la directory templates_
    codice:
    <html>
      <head>
        <title>Smarty</title>
      </head>
      <body>
        Hello, {$name}!
      </body>
    </html>
    conoscete un modo per vedere dove sono gli errori??
    perchè compare solo pagina bianca.....

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 © 2025 vBulletin Solutions, Inc. All rights reserved.