Pagina 1 di 2 12 UltimoUltimo
Visualizzazione risultati 1 fino 30 di 35

Discussione: [php] problema codice

  1. #1
    Guest

    Predefinito [php] problema codice

    Salve. Mi serve il vostro aiuto. Purtroppo non mi intendo per niente di php, ma mi sono trovata con quwesto codice da modificare da sola e non so dove mettere le mani.Avevo aggiunto un file txt con una tag cbox, aggiungendo al

    Codice:
    function tagboard()
    ho aggiunto questo


    Codice:
    print_file('./files/tag.txt');
    ma quando ho aperto la pagina, mi diceva errore al doctype, così ho aggiunto

    Codice:
    {
    	puts(' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html401/strict.dtd">');
    }
    ma niente e ora dice:

    Parse error: syntax error, unexpected T_STRING in /hsphere/local/home/lonelyst/3doorsdown.se/index.php on line 13

    Link:www.3doorsdown.se

    Potete controllare il topic e dirmi il problema? :(

    Questo è il file functions.php

    Codice:
    s($string)
    {
    	echo $string."\n";
    }
    
    function doctype()
    {
    	puts(' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html401/strict.dtd">');
    }
    
    function head($title = '3 Doors Down - Swedish Street Team', $content_type = 'text/html; charset=iso-8859-1', $css)
    {
    	if(empty($title)) {
    		$title = '3 Doors Down - Swedish Street Team';
    	}
    
    	if(empty($content_type)) {
    		$content_type = 'text/html; charset=iso-8859-1';
    	}
    	puts('<html>');
    	puts('<head>');
    	puts('<title>'.$title.'</title>');
    	puts('<meta http-equiv="Content-Type" content="'.$content_type.'">');
    	if(is_array($css)) {
    		foreach($css as $style) {
    			if($style == '/css/iehacks.css') {
    				puts('<!--[if IE]><link rel="StyleSheet" type="text/css" href="'.$style.'"><![endif]-->');
    			} else {
    				puts('<link rel="StyleSheet" type="text/css" href="'.$style.'">');
    			}
    		}
    	} else {
    		puts('<link rel="StyleSheet" type="text/css" href="'.$css.'">');
    	}
    	puts('</head>');
    }
    
    function logo()
    {
    	$rand = mt_rand(1,5);
    	puts('<body>');
    	puts('<div id="main">');
    	puts('<div id="header"><img src="/images/3dd_logo_'.$rand.'.jpg" alt=""></div>');
    }
    
    function menu()
    {
    	?>
    <div id="menu">
    <ul>
    <li><a href="/info.php"><img src="/images/3dd_3_doors_down.jpg" alt=""></a></li>
    <li><a href="/gallery.php"><img src="/images/3dd_gallery.jpg" alt=""></a></li>
    <li><a href="/multimedia.php"><img src="/images/3dd_multimedia.jpg" alt=""></a></li>
    <li><a href="/support.php"><img src="/images/3dd_support.jpg" alt=""></a></li>
    <li><a href="/streetteam.php"><img src="/images/3dd_street_team.jpg" alt=""></a></li>
    <li><a href="/links.php"><img src="/images/3dd_links.jpg" alt=""></a></li>
    <li><a href="/"><img src="/images/3dd_home.jpg" alt=""></a></li>
    </ul>
    </div>
    	<?php
    
    
    function left_bar()
    {
    	puts('<div id="content">');
    	puts('<div id="left_bar">');
    	welcome();
    	tagboard();
    	puts('</div>');
    }
    
    function middle_bar($string)
    {
    	puts('<div id="middle_bar">');
    	puts('<div id="info"><p>'.$string.'</p></div>');
    	puts('</div>');
    }
    
    function right_bar()
    {
    	puts('<div id="right_bar">');
    	message();
    	about();
    	puts('</div>');
    }
    
    function about()
    {
    	puts('<div id="about"><img src="images/3dd_about.jpg" alt=""><p>');
    	print_file('./files/about.txt');
    	puts('</p></div>');
    }
    
    function message()
    {
    	puts('<div id="message"><img src="images/3dd_message.jpg" alt=""><p>');
    	print_file('./files/message.txt');
    	puts('</p></div>');
    }
    function tagboard()
    {
    	puts('<div id="tagboard"><img src="images/3dd_tag_board.jpg" alt=""><p>');
    	
    	puts('</p></div>');
    }
    
    function welcome()
    {
    	puts('<div id="welcome"><img src="images/3dd_welcome.jpg" alt=""><p>');
    	print_file('./files/welcome.txt');
    	puts('</p></div>');
    }
    
    function print_file($file)
    {
    	$handle = fopen($file, 'r');
    	if(filesize($file) == 0) { $filesize = 1; } else { $filesize = filesize($file); }
    	$content = fread($handle, $filesize);
    	fclose($handle);
    	puts($content);
    }
    
    function footer()
    {
    	puts('<div id="footer"><p>');
    	print_file('./files/footer.txt');
    	puts('</p></div>');
    	puts('</div>');
    puts('</div>');
    	puts('</body>');
    	puts('</html>');
    }
    
    function connect()
    {
    	// Settings
    	$host = 'mydb4.surftown.se';
    	$user = 'LonelyS_ddd';
    	$passwd = 'kalle';
    	$db = 'LonelyS_ddd';
    
    	mysql_connect($host, $user, $passwd)or die(mysql_error());
    	mysql_select_db($db)or die(mysql_error());
    }
    
    function marquee()
    {
    puts('<div id="marquee">');
    puts('<p>Hello world!</p>');
    puts('</div>');
    }
    ?>

    ecco l'index (www.3doorsdown.se/index.php):

    Codice:
    <?php
    define('INCLUDED', true);
    include 'functions.php';
    connect();
    $ip = $_SERVER['REMOTE_ADDR'];
    $result = mysql_query('SELECT * FROM `visitors` WHERE ip="'.$ip.'"');
    if(mysql_num_rows($result) == 0) {
    	$sql = 'INSERT INTO `visitors` (`ip`) VALUES ("'.$ip.'")';
    	mysql_query($sql)or die(mysql_error());
    }
    $visitors = mysql_num_rows(mysql_query('SELECT id FROM visitors'));
    doctype()
    puts(' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html401/strict.dtd">');
    
    
    
    head('', '', '/css/enter.css');
    puts('<body>');
    puts('<div id="enter">');
    puts('<a href="/home.php"><img src="/images/enter.gif" alt=""><img src="/images/enter.jpg" alt=""></a>');
    puts('<p>Requirements: Love and Respect for 3 Doors Down.</p>');
    puts('<p>© The Swedish Street Team 2005-2007</p>');
    puts('<img src="/visitors.php" alt="" class="counter">');
    puts('</div>');
    puts('</body></html>');
    ?>
    E l'home (www.3doorsdown.se/home.php):

    Codice:
    <?php
    define('INCLUDED', true);
    include './functions.php';
    doctype()
    {
    	puts(' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html401/strict.dtd">');
    }
    $css = array('/css/layout.css', '/css/iehacks.css');
    head('', '', $css);
    logo();
    menu();
    marquee();
    left_bar();
    $file = './files/info.txt';
    $h = fopen($file, 'r');
    if(filesize($file) == 0) {
    	$filesize = 1;
    } else {
    	$filesize = filesize($file);
    }
    $content = fread($h, $filesize); fclose($h);
    middle_bar($content);
    right_bar();
    footer();

    Per favore aiutatemi, non so davvero che fare :( [/B]

  2. #2
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    Nel file "index.php" aggiungi il punto e virgola dopo "doctype()".
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

  3. #3
    Guest

    Predefinito

    fatto!! ancora errore O_o

  4. #4
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    Che errore ti esce?
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

  5. #5
    Guest

    Predefinito

    dice:

    Fatal error: Call to undefined function: doctype() in /hsphere/local/home/lonelyst/3doorsdown.se/index.php on line 12

  6. #6
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    Il file "function.php" si trova nella stessa cartella di "index.php"?
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

  7. #7
    Guest

    Predefinito

    sisi!!

  8. #8
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    Prova a modificare:
    Codice PHP:
    include 'functions.php';
    Con:
    Codice PHP:
    include "functions.php";
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

  9. #9
    Guest

    Predefinito

    niente...dice:

    Fatal error: Call to undefined function: doctype() in /hsphere/local/home/lonelyst/3doorsdown.se/index.php on line 12

  10. #10
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    In "functions.php" prova a modificare:
    Codice PHP:
    s($string)
    {
    echo
    $string."\n";
    }
    Con:
    Codice PHP:
    function s($string)
    {
    echo
    $string."\n";
    }
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

  11. #11
    Guest

    Predefinito

    modificato..niente ancora :(
    ma non capisco..funzionava tutto :(

    adeso functions.php è così

    Codice:
     function s($string)
    {
        echo $string."\n";
    }  
    
    function doctype()
    {
    	echo(' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html401/strict.dtd">');
    }
    
    function head($title = '3 Doors Down - Swedish Street Team',  $css)
    {
    	if(empty($title)) {
    		$title = '3 Doors Down - Swedish Street Team';
    	}
    
    	if(empty($content_type)) {
    		$content_type = 'text/html; charset=iso-8859-1';
    	}
    	echo('<html>');
    	echo('<head>');
    	echo('<title>'.$title.'</title>');
    	echo('<meta http-equiv="Content-Type" content="'.$content_type.'">');
    	if(is_array($css)) {
    		foreach($css as $style) {
    			if($style == '/css/iehacks.css') {
    				echo('<!--[if IE]><link rel="StyleSheet" type="text/css" href="'.$style.'"><![endif]-->');
    			} else {
    				echo('<link rel="StyleSheet" type="text/css" href="'.$style.'">');
    			}
    		}
    	} else {
    		echo('<link rel="StyleSheet" type="text/css" href="'.$css.'">');
    	}
    	echo('</head>');
    }
    
    function logo()
    {
    	$rand = mt_rand(1,5);
    	echo('<body>');
    	echo('<div id="main">');
    	echo('<div id="header"><img src="/images/3dd_logo_'.$rand.'.jpg" alt=""></div>');
    }
    
    function menu()
    {
    	?>
    <div id="menu">
    <ul>
    <li><a href="/info.php"><img src="/images/3dd_3_doors_down.jpg" alt=""></a></li>
    <li><a href="/gallery.php"><img src="/images/3dd_gallery.jpg" alt=""></a></li>
    <li><a href="/multimedia.php"><img src="/images/3dd_multimedia.jpg" alt=""></a></li>
    <li><a href="/support.php"><img src="/images/3dd_support.jpg" alt=""></a></li>
    <li><a href="/streetteam.php"><img src="/images/3dd_street_team.jpg" alt=""></a></li>
    <li><a href="/links.php"><img src="/images/3dd_links.jpg" alt=""></a></li>
    <li><a href="/"><img src="/images/3dd_home.jpg" alt=""></a></li>
    </ul>
    </div>
    	<?php
    
    
    function left_bar()
    {
    	echo('<div id="content">');
    	echo('<div id="left_bar">');
    	welcome();
    	tagboard();
    	echo('</div>');
    }
    
    function middle_bar($string)
    {
    	echo('<div id="middle_bar">');
    	echo('<div id="info"><p>'.$string.'</p></div>');
    	echo('</div>');
    }
    
    function right_bar()
    {
    	echo('<div id="right_bar">');
    	message();
    	about();
    	echo('</div>');
    }
    
    function about()
    {
    	echo('<div id="about"><img src="images/3dd_about.jpg" alt=""><p>');
    	print_file('./files/about.txt');
    	echo('</p></div>');
    }
    
    function message()
    {
    	echo('<div id="message"><img src="images/3dd_message.jpg" alt=""><p>');
    	print_file('./files/message.txt');
    	echo('</p></div>');
    }
    function tagboard()
    {
    	echo('<div id="tagboard"><img src="images/3dd_tag_board.jpg" alt=""><p>');
    	echo('</p></div>');
    }
    
    function welcome()
    {
    	echo('<div id="welcome"><img src="images/3dd_welcome.jpg" alt=""><p>');
    	print_file('./files/welcome.txt');
    	echo('</p></div>');
    }
    
    function print_file($file)
    {
    	$handle = fopen($file, 'r');
    	if(filesize($file) == 0) { $filesize = 1; } else { $filesize = filesize($file); }
    	$content = fread($handle, $filesize);
    	fclose($handle);
    	echo($content);
    }
    
    function footer()
    {
    	echo('<div id="footer"><p>');
    	print_file('./files/footer.txt');
    	echo('</p></div>');
    	echo('</div>');
    echo('</div>');
    	echo('</body>');
    	echo('</html>');
    }
    
    function connect()
    {
    	// Settings
    	$host = 'mydb4.surftown.se';
    	$user = 'LonelyS_ddd';
    	$passwd = 'kalle';
    	$db = 'LonelyS_ddd';
    
    	mysql_connect($host, $user, $passwd)or die(mysql_error());
    	mysql_select_db($db)or die(mysql_error());
    }
    
    function marquee()
    {
    echo('<div id="marquee">');
    echo('<p>Hello world!</p>');
    echo('</div>');
    }
    ?>

  12. #12
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    All'inizio di "functions.php" è presente "<?php" o "<?"? Se non c'è, aggiungilo.
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

  13. #13
    Guest

    Predefinito

    è scopartso la parte di codice codice dalla pagina, ma ora dice:

    Parse error: syntax error, unexpected $end in /hsphere/local/home/lonelyst/3doorsdown.se/functions.php on line 152


    sarebbe il rigo dov'è ?>

  14. #14
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    Hai dimenticato di chiudere la funzione menu. Dopo a "<?php" che hai scritto dopo la funzione menu aggiungi "}".
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

  15. #15
    L'avatar di mythologia
    mythologia non è connesso Moderatore
    Data registrazione
    05-01-2004
    Messaggi
    2,614

    Predefinito

    Manca un }

    Codice PHP:
    <?

    function s($string)
    {
    echo
    $string."\n";
    }

    function
    doctype()
    {
    echo(
    ' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html401/strict.dtd">');
    }

    function
    head($title = '3 Doors Down - Swedish Street Team', $css)
    {
    if(empty(
    $title)) {
    $title = '3 Doors Down - Swedish Street Team';
    }

    if(empty(
    $content_type)) {
    $content_type = 'text/html; charset=iso-8859-1';
    }
    echo(
    '<html>');
    echo(
    '<head>');
    echo(
    '<title>'.$title.'</title>');
    echo(
    '<meta http-equiv="Content-Type" content="'.$content_type.'">');
    if(
    is_array($css)) {
    foreach(
    $css as $style) {
    if(
    $style == '/css/iehacks.css') {
    echo(
    '<!--[if IE]><link rel="StyleSheet" type="text/css" href="'.$style.'"><![endif]-->');
    } else {
    echo(
    '<link rel="StyleSheet" type="text/css" href="'.$style.'">');
    }
    }
    } else {
    echo(
    '<link rel="StyleSheet" type="text/css" href="'.$css.'">');
    }
    echo(
    '</head>');
    }

    function
    logo()
    {
    $rand = mt_rand(1,5);
    echo(
    '<body>');
    echo(
    '<div id="main">');
    echo(
    '<div id="header"><img src="/images/3dd_logo_'.$rand.'.jpg" alt=""></div>');
    }

    function
    menu()
    {
    ?>
    <div id="menu">
    <ul>
    <li><a href="/info.php"><img src="/images/3dd_3_doors_down.jpg" alt=""></a></li>
    <li><a href="/gallery.php"><img src="/images/3dd_gallery.jpg" alt=""></a></li>
    <li><a href="/multimedia.php"><img src="/images/3dd_multimedia.jpg" alt=""></a></li>
    <li><a href="/support.php"><img src="/images/3dd_support.jpg" alt=""></a></li>
    <li><a href="/streetteam.php"><img src="/images/3dd_street_team.jpg" alt=""></a></li>
    <li><a href="/links.php"><img src="/images/3dd_links.jpg" alt=""></a></li>
    <li><a href="/"><img src="/images/3dd_home.jpg" alt=""></a></li>
    </ul>
    </div>
    <?php
    }

    function
    left_bar()
    {
    echo(
    '<div id="content">');
    echo(
    '<div id="left_bar">');
    welcome();
    tagboard();
    echo(
    '</div>');
    }

    function
    middle_bar($string)
    {
    echo(
    '<div id="middle_bar">');
    echo(
    '<div id="info"><p>'.$string.'</p></div>');
    echo(
    '</div>');
    }

    function
    right_bar()
    {
    echo(
    '<div id="right_bar">');
    message();
    about();
    echo(
    '</div>');
    }

    function
    about()
    {
    echo(
    '<div id="about"><img src="images/3dd_about.jpg" alt=""><p>');
    print_file('./files/about.txt');
    echo(
    '</p></div>');
    }

    function
    message()
    {
    echo(
    '<div id="message"><img src="images/3dd_message.jpg" alt=""><p>');
    print_file('./files/message.txt');
    echo(
    '</p></div>');
    }
    function
    tagboard()
    {
    echo(
    '<div id="tagboard"><img src="images/3dd_tag_board.jpg" alt=""><p>');
    echo(
    '</p></div>');
    }

    function
    welcome()
    {
    echo(
    '<div id="welcome"><img src="images/3dd_welcome.jpg" alt=""><p>');
    print_file('./files/welcome.txt');
    echo(
    '</p></div>');
    }

    function
    print_file($file)
    {
    $handle = fopen($file, 'r');
    if(
    filesize($file) == 0) { $filesize = 1; } else { $filesize = filesize($file); }
    $content = fread($handle, $filesize);
    fclose($handle);
    echo(
    $content);
    }

    function
    footer()
    {
    echo(
    '<div id="footer"><p>');
    print_file('./files/footer.txt');
    echo(
    '</p></div>');
    echo(
    '</div>');
    echo(
    '</div>');
    echo(
    '</body>');
    echo(
    '</html>');
    }

    function
    connect()
    {
    // Settings
    $host = 'mydb4.surftown.se';
    $user = 'LonelyS_ddd';
    $passwd = 'kalle';
    $db = 'LonelyS_ddd';

    mysql_connect($host, $user, $passwd)or die(mysql_error());
    mysql_select_db($db)or die(mysql_error());
    }

    function
    marquee()
    {
    echo(
    '<div id="marquee">');
    echo(
    '<p>Hello world!</p>');
    echo(
    '</div>');
    }
    ?>
    EDIT: Funcool mi ha anticipato...
    Ultima modifica di mythologia : 15-06-2007 alle ore 10.55.26

  16. #16
    Guest

    Predefinito

    mmmm dice che non doveva essere aggiunto :S
    però senza nemmeno funziona

    Parse error: syntax error, unexpected '}' in /hsphere/local/home/lonelyst/3doorsdown.se/functions.php on line 61


    //edit

    no aspetta ora funzione..però adesso alla home mi dice

    Parse error: syntax error, unexpected T_VARIABLE in /hsphere/local/home/lonelyst/3doorsdown.se/home.php on line 5

    :(((((((((((
    Ultima modifica di jennifersky : 15-06-2007 alle ore 10.57.47

  17. #17
    L'avatar di mythologia
    mythologia non è connesso Moderatore
    Data registrazione
    05-01-2004
    Messaggi
    2,614

    Predefinito

    Bhe, ovvio... quella non è una funzione... che senso ha creare una funzione senza niente di php? A limite metti un echo o un print:

    Codice PHP:
    <?

    function s($string)
    {
    echo
    $string."\n";
    }

    function
    doctype()
    {
    echo(
    ' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html401/strict.dtd">');
    }

    function
    head($title = '3 Doors Down - Swedish Street Team', $css)
    {
    if(empty(
    $title)) {
    $title = '3 Doors Down - Swedish Street Team';
    }

    if(empty(
    $content_type)) {
    $content_type = 'text/html; charset=iso-8859-1';
    }
    echo(
    '<html>');
    echo(
    '<head>');
    echo(
    '<title>'.$title.'</title>');
    echo(
    '<meta http-equiv="Content-Type" content="'.$content_type.'">');
    if(
    is_array($css)) {
    foreach(
    $css as $style) {
    if(
    $style == '/css/iehacks.css') {
    echo(
    '<!--[if IE]><link rel="StyleSheet" type="text/css" href="'.$style.'"><![endif]-->');
    } else {
    echo(
    '<link rel="StyleSheet" type="text/css" href="'.$style.'">');
    }
    }
    } else {
    echo(
    '<link rel="StyleSheet" type="text/css" href="'.$css.'">');
    }
    echo(
    '</head>');
    }

    function
    logo()
    {
    $rand = mt_rand(1,5);
    echo(
    '<body>');
    echo(
    '<div id="main">');
    echo(
    '<div id="header"><img src="/images/3dd_logo_'.$rand.'.jpg" alt=""></div>');
    }

    function
    menu()
    {
    print(
    '
    <div id="menu">
    <ul>
    <li><a href="/info.php"><img src="/images/3dd_3_doors_down.jpg" alt=""></a></li>
    <li><a href="/gallery.php"><img src="/images/3dd_gallery.jpg" alt=""></a></li>
    <li><a href="/multimedia.php"><img src="/images/3dd_multimedia.jpg" alt=""></a></li>
    <li><a href="/support.php"><img src="/images/3dd_support.jpg" alt=""></a></li>
    <li><a href="/streetteam.php"><img src="/images/3dd_street_team.jpg" alt=""></a></li>
    <li><a href="/links.php"><img src="/images/3dd_links.jpg" alt=""></a></li>
    <li><a href="/"><img src="/images/3dd_home.jpg" alt=""></a></li>
    </ul>
    </div>
    '
    );
    }

    function
    left_bar()
    {
    echo(
    '<div id="content">');
    echo(
    '<div id="left_bar">');
    welcome();
    tagboard();
    echo(
    '</div>');
    }

    function
    middle_bar($string)
    {
    echo(
    '<div id="middle_bar">');
    echo(
    '<div id="info"><p>'.$string.'</p></div>');
    echo(
    '</div>');
    }

    function
    right_bar()
    {
    echo(
    '<div id="right_bar">');
    message();
    about();
    echo(
    '</div>');
    }

    function
    about()
    {
    echo(
    '<div id="about"><img src="images/3dd_about.jpg" alt=""><p>');
    print_file('./files/about.txt');
    echo(
    '</p></div>');
    }

    function
    message()
    {
    echo(
    '<div id="message"><img src="images/3dd_message.jpg" alt=""><p>');
    print_file('./files/message.txt');
    echo(
    '</p></div>');
    }
    function
    tagboard()
    {
    echo(
    '<div id="tagboard"><img src="images/3dd_tag_board.jpg" alt=""><p>');
    echo(
    '</p></div>');
    }

    function
    welcome()
    {
    echo(
    '<div id="welcome"><img src="images/3dd_welcome.jpg" alt=""><p>');
    print_file('./files/welcome.txt');
    echo(
    '</p></div>');
    }

    function
    print_file($file)
    {
    $handle = fopen($file, 'r');
    if(
    filesize($file) == 0) { $filesize = 1; } else { $filesize = filesize($file); }
    $content = fread($handle, $filesize);
    fclose($handle);
    echo(
    $content);
    }

    function
    footer()
    {
    echo(
    '<div id="footer"><p>');
    print_file('./files/footer.txt');
    echo(
    '</p></div>');
    echo(
    '</div>');
    echo(
    '</div>');
    echo(
    '</body>');
    echo(
    '</html>');
    }

    function
    connect()
    {
    // Settings
    $host = 'mydb4.surftown.se';
    $user = 'LonelyS_ddd';
    $passwd = 'kalle';
    $db = 'LonelyS_ddd';

    mysql_connect($host, $user, $passwd)or die(mysql_error());
    mysql_select_db($db)or die(mysql_error());
    }

    function
    marquee()
    {
    echo(
    '<div id="marquee">');
    echo(
    '<p>Hello world!</p>');
    echo(
    '</div>');
    }
    ?>
    Ultima modifica di mythologia : 15-06-2007 alle ore 11.00.58

  18. #18
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    In "home.php" puoi cancellare:
    Codice PHP:
    doctype()
    {
    puts(' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html401/strict.dtd">');
    }
    Perché hai già definito la funzione dentro al file "functions.php".
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

  19. #19
    Guest

    Predefinito

    in home devo averlo già tolto

    il codice home.php è:

    Codice:
    <?php
    define('INCLUDED', true);
    include './functions.php';
    doctype()
    $css = array('/css/layout.css', '/css/iehacks.css');
    head('', '', $css);
    logo();
    menu();
    marquee();
    left_bar();
    $file = './files/info.txt';
    $h = fopen($file, 'r');
    if(filesize($file) == 0) {
    	$filesize = 1;
    } else {
    	$filesize = filesize($file);
    }
    $content = fread($h, $filesize); fclose($h);
    middle_bar($content);
    right_bar();
    footer();
    ?>

  20. #20
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    Aggiungi il ";" dopo "doctype()".
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

  21. #21
    L'avatar di mythologia
    mythologia non è connesso Moderatore
    Data registrazione
    05-01-2004
    Messaggi
    2,614

    Predefinito

    Attento alle ;

    Codice PHP:
    <?php
    define
    ('INCLUDED', true);
    include
    './functions.php';
    doctype();
    $css = array('/css/layout.css', '/css/iehacks.css');
    head('', '', $css);
    logo();
    menu();
    marquee();
    left_bar();
    $file = './files/info.txt';
    $h = fopen($file, 'r');
    if(
    filesize($file) == 0) {
    $filesize = 1;
    } else {
    $filesize = filesize($file);
    }
    $content = fread($h, $filesize); fclose($h);
    middle_bar($content);
    right_bar();
    footer();
    ?>
    EDIT: Funcool è velocissimo
    Ultima modifica di mythologia : 15-06-2007 alle ore 11.05.32

  22. #22
    Guest

    Predefinito

    ahhh adesso funziona!!! Grazie a entrambi...ma come mai nè l'index, nè l'home mi leggono i css :S

  23. #23
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    Modifica:
    Codice PHP:
    head('', '', $css);
    In:
    Codice PHP:
    head('', $css);
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

  24. #24
    Guest

    Predefinito

    grazie mille!! ora funziona tutto!!!

    posso chiedere una cosa??
    inizialmente il codice funzionava e poi aggiujngendo la tag, è successo questo casino senza che toccassi il codice...ora se volessi aggiungere la tag, andrei incotnro allo stesso problema? O_o

  25. #25
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    Beh, basta che la aggiungi senza fare casini...
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

  26. #26
    Guest

    Predefinito

    haha proverò :)

    grazie davvero per la disponibilità!! Spero di non dover scrivere ancora, significherebbe che non ho fatto niente di compromettente
    Ultima modifica di jennifersky : 15-06-2007 alle ore 11.20.56

  27. #27
    Guest

    Predefinito

    emmm rieccomi ^^
    non ho fatto nessun altro casino ma non so dove inserire questo script per farlo funzionare..è un effetto dissolvenza di testo che andrebbe in tutte le pagine (esempio home). Ho trovato una funziona marquee in functions.php e pensa vada lì..ma non riesco a metterlo in modo che non mi sballi la pagina....
    vi metto un pò di codici :)

    HOME.PHP:

    Codice:
    <?php
    define('INCLUDED', true);
    include './functions.php';
    doctype();
    $css = array('/css/layout.css', '/css/iehacks.css');
     head('', $css);  
    logo();
    menu();
    marquee();
    left_bar();
    $file = './files/news.txt';
    $h = fopen($file, 'r');
    if(filesize($file) == 0) {
    	$filesize = 1;
    } else {
    	$filesize = filesize($file);
    }
    $content = fread($h, $filesize); fclose($h);
    middle_bar($content);
    right_bar();
    footer();
    ?>
    FUNCTIONS.PHP

    Codice:
    <?
    
     function s($string)
    {
        echo $string."\n";
    }  
    
    function doctype()
    {
        echo(' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html401/strict.dtd">');
    }
    
    function head($title = '3 Doors Down - Swedish Street Team',  $css)
    {
        if(empty($title)) {
            $title = '3 Doors Down - Swedish Street Team';
        }
    
        if(empty($content_type)) {
            $content_type = 'text/html; charset=iso-8859-1';
        }
        echo('<html>');
        echo('<head>');
        echo('<title>'.$title.'</title>');
        echo('<meta http-equiv="Content-Type" content="'.$content_type.'">');
        if(is_array($css)) {
            foreach($css as $style) {
                if($style == '/css/iehacks.css') {
                    echo('<!--[if IE]><link rel="StyleSheet" type="text/css" href="'.$style.'"><![endif]-->');
                } else {
                    echo('<link rel="StyleSheet" type="text/css" href="'.$style.'">');
                }
            }
        } else {
            echo('<link rel="StyleSheet" type="text/css" href="'.$css.'">');
        }
        echo('</head>');
    }
    
    function logo()
    {
        $rand = mt_rand(1,5);
        echo('<body>');
        echo('<div id="main">');
        echo('<div id="header"><img src="/images/3dd_logo_'.$rand.'.jpg" alt=""></div>');
    }
    
    function menu()
    {
        ?>
    <div id="menu">
    <ul>
    <li><a href="/info.php"><img src="/images/3dd_3_doors_down.jpg" alt=""></a></li>
    <li><a href="/gallery.php"><img src="/images/3dd_gallery.jpg" alt=""></a></li>
    <li><a href="/multimedia.php"><img src="/images/3dd_multimedia.jpg" alt=""></a></li>
    <li><a href="/support.php"><img src="/images/3dd_support.jpg" alt=""></a></li>
    <li><a href="/streetteam.php"><img src="/images/3dd_street_team.jpg" alt=""></a></li>
    <li><a href="/links.php"><img src="/images/3dd_links.jpg" alt=""></a></li>
    <li><a href="/"><img src="/images/3dd_home.jpg" alt=""></a></li>
    </ul>
    </div>
        <?php
    }
    
    function left_bar()
    {
        echo('<div id="content">');
        echo('<div id="left_bar">');
        welcome();
        tagboard();
        echo('</div>');
    }
    
    function middle_bar($string)
    {
        echo('<div id="middle_bar">');
        echo('<div id="info"><p>'.$string.'</p></div>');
        echo('</div>');
    }
    
    function right_bar()
    {
        echo('<div id="right_bar">');
        message();
        about();
        echo('</div>');
    }
    
    function about()
    {
        echo('<div id="about"><img src="images/3dd_about.jpg" alt=""><p>');
        print_file('./files/about.txt');
        echo('</p></div>');
    }
    
    function message()
    {
        echo('<div id="message"><img src="images/3dd_message.jpg" alt=""><p>');
        print_file('./files/message.txt');
        echo('</p></div>');
    }
    function tagboard()
    {
        echo('<div id="tagboard"><img src="images/3dd_tag_board.jpg" alt=""><p>');
        echo('</p></div>');
    }
    
    function welcome()
    {
        echo('<div id="welcome"><img src="images/3dd_welcome.jpg" alt=""><p>');
        print_file('./files/welcome.txt');
        echo('</p></div>');
    }
    
    function print_file($file)
    {
        $handle = fopen($file, 'r');
        if(filesize($file) == 0) { $filesize = 1; } else { $filesize = filesize($file); }
        $content = fread($handle, $filesize);
        fclose($handle);
        echo($content);
    }
    
    function footer()
    {
        echo('<div id="footer"><p>');
        print_file('./files/footer.txt');
        echo('</p></div>');
        echo('</div>');
    echo('</div>');
        echo('</body>');
        echo('</html>');
    }
    
    function connect()
    {
        // Settings
        $host = 'mydb4.surftown.se';
        $user = 'LonelyS_ddd';
        $passwd = 'kalle';
        $db = 'LonelyS_ddd';
    
        mysql_connect($host, $user, $passwd)or die(mysql_error());
        mysql_select_db($db)or die(mysql_error());
    }
    
    function marquee()
    {
    echo('<div id="marquee">');
    echo('<p>Hello world!</p>');
    echo('</div>');
    }
    ?>
    *continua al post seguente

  28. #28
    Guest

    Predefinito

    SCRIPT DELL'EFFETTO:

    Codice:
    <script type="text/javascript">
    
    /***********************************************
    * Fading Scroller- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    var delay = 2000; //set delay between message change (in miliseconds)
    var maxsteps=30; // number of steps to take to change from start color to endcolor
    var stepdelay=290; // time in miliseconds of a single step
    //**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
    var startcolor= new Array(201,119,33); // start color (red, green, blue)
    var endcolor=new Array(0,0,0); // end color (red, green, blue)
    
    var fcontent=new Array();
    begintag='<div style="font: normal 11px Verdana; padding: 5px;">'; //set opening tag, such as font declarations
    fcontent[0]="You called me strong, you called me weak, but still your secrets I will keep - Kryptonite";
    fcontent[1]="I watched the world float to the dark side of the moon - Kryptonite";
    fcontent[2]="Addiction needs a pacifier, the buzz of this poison is taking me higher - Loser";
    fcontent[3]="Someday I will find, a love that flows through me like this - Loser";
    fcontent[4]="So you call this your free country, tell me why it costs so much to live - Duck And Run";
    fcontent[5]="Walk a mile just to move an inch now even though I'm trying so damn hard - Duck And Run";
    fcontent[6]="Shackled down, kicked around, now slave to the grind - Not Enough";
    fcontent[7]="Same old song world moves on while I'm still in bed - Not Enough";
    fcontent[8]="He spends his nights in California, watching the stars on the big screen - Be Like That";
    fcontent[9]="All she wants is just that something to hold onto, that's all she needs - Be Like That";
    fcontent[10]="Looking forward, not behind, everybody's got to cross that line - Life Of My Own";
    fcontent[11]="Living risky, never scared, wander closer to the edge - Life Of My Own";
    fcontent[12]="I'm about to see just how far I can fly, surely your gonna break my fall - Better Life";
    fcontent[13]="I'm about to be on the floor again, surely you're gonna find me here - Better Life";
    fcontent[14]="Welcome to my world she said, do you feel alive she said - Down Poison";
    fcontent[15]="You weren't there for me, I was there for you - Down Poison";
    fcontent[16]="A petty maze of emptiness, I've said the hell with all the rest - By My Side";
    fcontent[17]="Sober mind time now is gone, they carved my body not of stone - By My Side";
    fcontent[18]="Throw my life away, and I'll be worthless just like you - Smack";
    fcontent[19]="Perfect little life you wasted, overdosed and that death you tasted - Smack";
    fcontent[20]="If you step into my head, tell me would you still know me - So I Need You";
    fcontent[21]="If you woke up in my bed, tell me then would you hold me - So I Need You";
    fcontent[22]="Now roaming through this darkness I'm alive but I'm alone - When I'm Gone";
    fcontent[23]="There's another world inside of me that you may never see - When I'm Gone";
    fcontent[24]="And now again I've found myself so far down - Away From The Sun";
    fcontent[25]="I miss the life, I miss the colors of the world - Away From The Sun";
    fcontent[26]="I know you feel helpless now and I know you feel alone - The Road I'm On";
    fcontent[27]="What you thought was real life somehow steered you wrong - The Road I'm On";
    fcontent[28]="When everything is said and done I won't have one thing left - Ticket To Heaven";
    fcontent[29]="To want is to buy but to live is to die and you can't take it all - Ticket to Heaven";
    fcontent[30]="All these little things in life, they all create this haze - Running Out Of Days";
    fcontent[31]="I feel this current it's so strong, it gets me futher down the line - Running Out Of Days";
    fcontent[32]="I think about you baby and I dream about you all the time - Here Without You";
    fcontent[33]="I've heard this life is overrated, but I hope it this gets better as we go - Here Without You";
    fcontent[34]="Another endless day another seven hundred miles - I Feel You";
    fcontent[35]="They gave me a life that's not so easy to live - I Feel You";
    fcontent[36]="The sound of bullets flyin' through the air, is followed by a cry - Dangerous Game";
    fcontent[37]="We've thrown all our hopes away and set our dreams aside - Dangerous Game";
    fcontent[38]="There's no one here to talk to and the pain is making me numb - Changes";
    fcontent[39]="I'm not suppose to be scared of anything, but I don't know where I am - Changes";
    fcontent[40]="Don't tell me how life is, 'cause I don't really wanna know - Going Down In Flames";
    fcontent[41]="Don't tell me what to believe, 'cause you won't be there - Going Down In Flames";
    fcontent[42]="She stood at the foot of the guilty bed last night - Sarah Yellin'";
    fcontent[43]="Now it's over, the old man is dead, lyin' on the ground - Sarah Yellin'";
    fcontent[44]="I know I get a little bit crazy but I've never done you no wrong - Right Where I Belong";
    fcontent[45]="It feels like I'm lying next to a ghost at night I don't know why - Right Where I Belong";
    fcontent[46]="Nevermind the face that you put on it front of me - It's Not Me";
    fcontent[47]="This life you gave away was meant for me - I'ts Not Me";
    fcontent[48]="One more kiss could be the best thing, one more lie could be the worst - Let Me Go";
    fcontent[49]="In this world there's real and make believe and this seems real to me - Let Me Go";
    fcontent[50]="The shades go up mother's staring down - Be Somebody";
    fcontent[51]="Mom, I'm trying and I'm living my life the best way I can - Be Somebody";
    fcontent[52]="All these days I spend away I'll make up for this a swear - Landing In London";
    fcontent[53]="I need your love to hold me up when it's all to much to bear - Landing In London";
    fcontent[54]="I won't stop now until I find a better part of me - The Real Life";
    fcontent[55]="I wanted somwhere to hide when I opened up and let those fears inside - The Real Life";
    fcontent[56]="I've seen this face once before and I don't think I can do this again - Behind Those Eyes";
    fcontent[57]="You said I got something to say, then you got that look in you eye - Behind Those Eyes";
    fcontent[58]="The road I walk is paved with broken promises I made - Never Will I Break";
    fcontent[59]="If you hear me screaming please don't let me fall again - Never Will I Break";
    fcontent[60]="In the glare of a neon sign she laid here body down - Father's Son";
    fcontent[61]="Maybe I'm just crazy or the devil got inside";
    fcontent[62]="I've bundled up all of these fears inside and I've bottled up all of this pain - Father's Son";
    fcontent[63]="God only knows all the places I've been but I love this lfe that I live'n in - Live For Today";
    fcontent[64]="We'll never know it when run out of time until it's all over - Live For Today";
    fcontent[65]="You're trapped inside this worl you made yourself - My World";
    fcontent[66]="You're stuck on a chain and you're towing down the line - My World";
    fcontent[67]="I'm sorry I can't always find the words to say - Here By Me";
    fcontent[68]="As the days roll on I see time is standing still for me when you're not here - Here By Me";
    closetag='</div>';
    
    var fwidth='150px'; //set scroller width
    var fheight='150px'; //set scroller height
    
    var fadelinks=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.
    
    ///No need to edit below this line/////////////////
    
    
    var ie4=document.all&&!document.getElementById;
    var DOM2=document.getElementById;
    var faderdelay=0;
    var index=0;
    
    
    /*Rafael Raposo edited function*/
    //function to change content
    function changecontent(){
      if (index>=fcontent.length)
        index=0
      if (DOM2){
        document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
        document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
        if (fadelinks)
          linkcolorchange(1);
        colorfade(1, 15);
      }
      else if (ie4)
        document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
      index++
    }
    
    // colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
    // Modified by Dynamicdrive.com
    
    function linkcolorchange(step){
      var obj=document.getElementById("fscroller").getElementsByTagName("A");
      if (obj.length>0){
        for (i=0;i<obj.length;i++)
          obj[i].style.color=getstepcolor(step);
      }
    }
    
    /*Rafael Raposo edited function*/
    var fadecounter;
    function colorfade(step) {
      if(step<=maxsteps) {	
        document.getElementById("fscroller").style.color=getstepcolor(step);
        if (fadelinks)
          linkcolorchange(step);
        step++;
        fadecounter=setTimeout("colorfade("+step+")",stepdelay);
      }else{
        clearTimeout(fadecounter);
        document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
        setTimeout("changecontent()", delay);
    	
      }   
    }
    
    /*Rafael Raposo's new function*/
    function getstepcolor(step) {
      var diff
      var newcolor=new Array(3);
      for(var i=0;i<3;i++) {
        diff = (startcolor[i]-endcolor[i]);
        if(diff > 0) {
          newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
        } else {
          newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
        }
      }
      return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
    }
    
    if (ie4||DOM2)
      document.write('<div id="fscroller" style="border:0px solid black;position:absolute;width:550;height:477;left:210;top:403;"></div>');
    
    if (window.addEventListener)
    window.addEventListener("load", changecontent, false)
    else if (window.attachEvent)
    window.attachEvent("onload", changecontent)
    else if (document.getElementById)
    window.onload=changecontent
    
    </script>

  29. #29
    Guest

    Predefinito

    Stesso problema per cutenews..dove aggiungo in home questo codice per aggiungere nel frame principale le news???

    Codice:
    <?PHP
    $number=1;
    $template="";
    include("/hsphere/local/home/lonelyst/3doorsdown.se/cutenews/show_news.php");
    ?>

    help please :) e scusate tutti questi post, ma dice che sono troppo lunghi per un solo intervento

  30. #30
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    Tutto dipende da dove vuoi inserire questo effetto.
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

Pagina 1 di 2 12 UltimoUltimo

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •