Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    classe a oggetti e niente output

    Codice PHP:
    class Dati extends config
    {
        var 
    $smarty;
        var 
    $db;
        
    /**
         * @author francesco straffi
         * @link [url]http://www.ilsitodifrancy.altervista.org[/url]
         * @package FRANCY SYSTEM
         * @version $Id: Index.class.php,v 1.0.0 beta 2006/11/18 15:42:49 based on ADOdb engine Exp $
         * @uses Core
         * @copyright (c) francesco straffi some right reserved
         * @license [url]http://opensource.org/licenses/gpl-license.php[/url] GNU Public License 
         */
        
    function Dati(){
            global 
    $userdata$db;
            
            
    parent::config();
        
            include_once(
    $this->sitedir '/includes/php/libs/Smarty.class.php');
            include_once(
    $this->sitedir '/includes/php/Db/adodb.inc.php');
            include_once(
    $this->sitedir '/includes/php/Db/adodb-exceptions.inc.php');
            include_once(
    $this->sitedir '/includes/php/singleton.php');
            include_once(
    $this->sitedir '/includes/php/interface.php');
            
            
    $this->smarty = new Smarty();
            
    /**
             * @var $this->smarty Smarty
             */
            
    $ADODB_CACHE_DIR $this->sitedir '/cache/database';
            
    $this->db NewADOConnection('mysql');
            
    /**
             * @var $this->db ADODB_mysql
             */
            
    $this->db->Connect($this->hostname$this->username$this->password$this->database);
            
    $this->db->fetchMode ADODB_FETCH_ASSOC;
            
    $this->smarty->template_dir    $this->sitedir.'/Theme'.'/classic'.'/templates';
            
    $this->smarty->compile_dir     $this->sitedir.'/cache/template_c';
            
    $this->smarty->config_dir      $this->sitedir.'/Theme'.'/classic'.'/config';
            
    $this->smarty->compile_check   true;
            
    $this->smarty->debugging       false;
            
    $this->smarty->left_delimiter  '<!--{';
            
    $this->smarty->right_delimiter '}-->';
        }
        protected function 
    menu(){
            global 
    $userdata$db;
            
    $sql "SELECT id, url, nome, visible
                FROM "
    .$this->prefix."page
                ORDER BY id    ASC
                LIMIT 0,10
                "
    ;
            
    $result $this->db->CacheExecute(3600$sql);
            
    $i 0;
            
            foreach(
    $result as $key => $menu)
            {
                if(
    $menu['visible'] == 1)
                {
                    if(
    preg_match('/http:\/\/.*?/is'$menu['url']))
                    {
                        
    $men[$i++] = $menu;
                    } else {
                        
    $men[$i++]          = $menu;
                        
    $men[$i 1]['int'] = true;
                    }
                }
            }

            return 
    $men ;
        }
        
        function 
    switch_page($center$header true$footer=true){
            global 
    $userdata$db;
            if(!isset(
    $center['page'])||empty($center['page'])){
                
    $pagename $p 'main';
            } else {
                
    $pagename $p $center['page'];
            }
            if(!
    file_exists($this->sitedir.'/page/'.$p.'.php'))
            {
                
    $pagename $p 'error';
            }
            include_once(
    $this->sitedir.'/page/'.$p.'.php');
            
            
    $class 'page_'.$p;
            
            
    $page = new $class();
            
            
    $var $page->page();
            
    $var['basedir']   = $this->sitedir;
            
    $var['title']     = $this->title;
            
    $var['forumurl']  = $this->forumurl;
            
    $var['siteurl']   = $this->siteurl;
            
    $var['menu']      = $this->menu();
            
    $var['gzip']      = $this->gzcompress;
            
    $var['google']    = $this->google;
            
    $var['googlekey'] = $this->googlekey;
            
    $var['userdata']  = $userdata;
            
    $var['avatar']    = $this->vedi_avatar($userdata'width="100" height="100"');
            
            foreach(
    $var as $name => $value){
                
    $this->smarty->assign($name$value);
            }
            
            
    $ret .= "";
            if(
    $header === true){
                
    $ret .= $this->smarty->fetch('header.tpl');
            }
            if(isset(
    $_REQUEST['query'])&&!empty($_REQUEST['query'])&&isset($_REQUEST['search'])){
                try{
                    
    $google PluginRepository::loadPlugin('Google'$this);
                    
    /**
                     * @var $google Google
                     */
                
    } catch(Exception $e) {
                        throw new 
    Exception($e->getMessage());
                    }
                
    $ret .= $google->_plugin();
            } else {
                
    $ret .= $this->smarty->fetch('page/'.$pagename.'.tpl');
            }
            if(
    $footer === true){
                
    $ret .= $this->smarty->fetch('footer.tpl');
            }
            return 
    $ret;
        }
        function  
    vedi_avatar($profiledata$paramImg "")
        {
            global 
    $board_config;
                    
            
    $avatar_img '';
            if ( 
    $profiledata['user_avatar_type'] && $profiledata['user_allowavatar'] )
            {
                switch( 
    $profiledata['user_avatar_type'] )
                {
                    case 
    USER_AVATAR_UPLOAD:
                        
    $avatar_img = ( $board_config['allow_avatar_upload'] ) ? '[img]'.$this->forumurl.'/' $board_config['avatar_path'] . '/' $profiledata['user_avatar'] . '[/img]' '';
                    break;
                    case 
    USER_AVATAR_REMOTE:
                        
    $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '[img]' $profiledata['user_avatar'] . '[/img]' '';
                    break;
                    case 
    USER_AVATAR_GALLERY:
                        
    $avatar_img = ( $board_config['allow_avatar_local'] ) ? '[img]/forum/' $board_config['avatar_gallery_path'] . '/' $profiledata['user_avatar'] . '[/img]' '';
                    break;
                }
            }
        return (
    $avatar_img);
        }
    }
    ?> 
    ho problemi con questa classe da me creata...
    non so come fare, perchè in locale funziona tutto e on-line niente???
    non mi da nessun errore, ma nun funziona neanche. Insomma... non manda output, cosa che invece in locale fa...
    cosa devo fare???
    il sito è:
    http://www.ilsitodifrancy.netsons.org.
    PS: chiunque lo conoscesse, e lo usasse, mi potrebbe spiegare come inserire nel database delle tabelle??? non riesco a usare phpmyadmin, poichè quando vado a visualizzare il contenuto del db si blocca....
    vi prego aiutatemi
    PS: le funzioni le richiamo

  2. #2
    c'è differenza tra la versione di php in locale sul server? Su netsons se nn sbaglio danno php5 forse in locale tu hai php4

  3. #3
    locale ho php 5.1 mentre sul server è 5.2... non so proprio ke fare... spero che ciò che ho detto serva...

  4. #4
    risolto...
    mi ero dimenticato che non avevo copiato le tabelle del database.

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.