Visualizzazione dei risultati da 1 a 6 su 6
  1. #1
    Utente di HTML.it
    Registrato dal
    Dec 2005
    Messaggi
    4

    problema con require/include di una pagina

    Ciao! Sto creando la nuova versione di un mio sito, utilizzando per la prima volta il PHP (con la creazione di un Blog eccetera).

    Ho creato quella che diventerà l'homepage del sito, con 3 colonne, si può vedere in anteprima a questo link (segreto) www.tonytammaro.com/secret2.php
    Nella colonna di centro devo richiamarmi una certa pagina (del Blog di Wordpress, modificata da me) quindi inserisco, nella colonna centrale, questo require:
    codice:
     
    <?php 
    define('WP_USE_THEMES', true);
    require('blog/wp-blog-header_homepage.php');
    ?>
    Ma a questo punto succede una cosa strana! come si può vedere da quest'altro link (segreto): www.tonytammaro.com/secret.php (la pagina viene richiamata,è funzionante e tutto a posto) MA la colonna di destra e il footer scompaiono!!!!! non si visualizzano più!!!

    Non me ne intendo molto di PHP quindi non so' se e perchè il require possa far sparire la colonna di destra!
    Qualcuno di voi sa' come potrei risolvere questo problema?? (prima di dover ricorrere all'ultima spiaggia: l'uso dei frames)

    Grazie!

  2. #2
    bidognerebbe sapere cosa fa il blog che ci metti a livello di codice...forse chiude l'"</html>"... oppure può essere che usi una variabile che usi anceh tu e ti crea cnfuzione.. nn lo so...

    prova a postare un po' di codice.. almeno quello tuo

  3. #3
    Utente di HTML.it
    Registrato dal
    Dec 2005
    Messaggi
    434
    no a quanto pare dal codice sorgente generato c'è qualche die o exit; posta il codice della pagina inclusa, ricorda che le pagina incluse includono il codice della pagina; non la pagina eseguita.
    Quindi se io mi ritrovo una pagina ciao.php con:
    include("path/file.php");
    path/file.php
    include("altrofile.php");
    include un file NELLA STESSA DIRECTORY di ciao.php, non quella di file.php!!

  4. #4
    Utente di HTML.it
    Registrato dal
    Dec 2005
    Messaggi
    4
    Ecco vi allego il codice di "blog/wp-blog-header_homepage.php", pagina che viene richiamata dall'home page!

    Questa pagina è una copia dell'originale (wp-blog-header.php) che ho modificato con decine di tentativi fino a quando non sono riuscito a togliere l'header, il footer del Blog e altre cose che non servono siano visualizzate anchein homepage! Quindi posso ancora farci qualsiasi modifica se necessario!

    codice:
    <head>
    <base target="_blank">
    </head>
    
    <?php
    
    if (! isset($wp_did_header)):
    if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
    	if ( strstr( $_SERVER['PHP_SELF'], 'wp-admin') ) $path = '';
    	else $path = 'wp-admin/';
        die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? We got it. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.");
    }
    
    
    
    require_once( dirname(__FILE__) . '/wp-config.php');
    
    $query_vars = array();
    
    // Process PATH_INFO and 404.
    if ((isset($_GET['error']) && $_GET['error'] == '404') ||
    		((! empty($_SERVER['PATH_INFO'])) &&
    		('/' != $_SERVER['PATH_INFO']) &&
    		 (false === strpos($_SERVER['PATH_INFO'], '.php'))
    		)) {
    
    	// If we match a rewrite rule, this will be cleared.
    	$error = '404';
    
    	// Fetch the rewrite rules.
    	$rewrite = $wp_rewrite->wp_rewrite_rules();
    
    	if (! empty($rewrite)) {
    		$pathinfo = $_SERVER['PATH_INFO'];
    		$req_uri = $_SERVER['REQUEST_URI'];      
    		$home_path = parse_url(get_settings('home'));
    		$home_path = $home_path['path'];
    
    		// Trim path info from the end and the leading home path from the
    		// front.  For path info requests, this leaves us with the requesting
    		// filename, if any.  For 404 requests, this leaves us with the
    		// requested permalink.	
    		$req_uri = str_replace($pathinfo, '', $req_uri);
    		$req_uri = str_replace($home_path, '', $req_uri);
    		$req_uri = trim($req_uri, '/');
    		$pathinfo = trim($pathinfo, '/');
    
    		// The requested permalink is in $pathinfo for path info requests and
    		//  $req_uri for other requests.
    		if (! empty($pathinfo)) {
    			$request = $pathinfo;
    		} else {
    			$request = $req_uri;
    		}
    
    		// Look for matches.
    		$request_match = $request;
    		foreach ($rewrite as $match => $query) {
    			// If the requesting file is the anchor of the match, prepend it
    			// to the path info.
    	    if ((! empty($req_uri)) && (strpos($match, $req_uri) === 0)) {
    	      $request_match = $req_uri . '/' . $request;
    	    }
    
    			if (preg_match("!^$match!", $request_match, $matches)) {
    				// Got a match.
    				// Trim the query of everything up to the '?'.
    				$query = preg_replace("!^.+\?!", '', $query);
    
    				// Substitute the substring matches into the query.
    				eval("\$query = \"$query\";");
    
    				// Parse the query.
    				parse_str($query, $query_vars);
    
    				// If we're processing a 404 request, clear the error var
    				// since we found something.
    				if (isset($_GET['error'])) {
    					unset($_GET['error']);
    				}
    
    				if (isset($error)) {
    					unset($error);
    				}
    
    				break;
    			}
    		}
    	}
     }
    
    $wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence', 'debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup');
    
    $wpvarstoreset = apply_filters('query_vars', $wpvarstoreset);
    
    for ($i=0; $i<count($wpvarstoreset); $i += 1) {
    	$wpvar = $wpvarstoreset[$i];
    	if (!isset($$wpvar)) {
    		if (empty($_POST[$wpvar])) {
    			if (empty($_GET[$wpvar]) && empty($query_vars[$wpvar])) {
    				$$wpvar = '';
    			} elseif (!empty($_GET[$wpvar])) {
    				$$wpvar = $_GET[$wpvar];
    			} else {
    				$$wpvar = $query_vars[$wpvar];
    			}
    		} else {
    			$$wpvar = $_POST[$wpvar];
    		}
    	}
    }
    
    // Sending HTTP headers
    
    if ( !empty($error) && '404' == $error ) {
    	if ( preg_match('/cgi/', php_sapi_name()) )
    		@header('Status: 404 Not Found');
    	else
    		@header('HTTP/1.x 404 Not Found');
     } else if ( empty($feed) ) {
    	@header('X-Pingback: '. get_bloginfo('pingback_url'));
    	@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
    } else {
    	// We're showing a feed, so WP is indeed the only thing that last changed
    	if ( $withcomments )
    		$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
    	else 
    		$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
    	$wp_etag = '"' . md5($wp_last_modified) . '"';
    	@header("Last-Modified: $wp_last_modified");
    	@header("ETag: $wp_etag");
    	@header('X-Pingback: ' . get_bloginfo('pingback_url'));
    
    	// Support for Conditional GET
    	if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) $client_etag = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']);
    	else $client_etag = false;
    
    	$client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE']);
    	// If string is empty, return 0. If not, attempt to parse into a timestamp
    	$client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
    
    	// Make a timestamp for our most recent modification...	
    	$wp_modified_timestamp = strtotime($wp_last_modified);
    
    	if ( ($client_last_modified && $client_etag) ?
    		(($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) :
    		(($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) {
    		if ( preg_match('/cgi/',php_sapi_name()) ) {
    			header('Status: 304 Not Modified');
    			echo "\r\n\r\n";
    			exit;
    		} else {
    			if ( version_compare(phpversion(), '4.3.0', '>=') )
    				header('Not Modified', TRUE, 304);
    			else
    				header('HTTP/1.x 304 Not Modified');
    			exit;
    		}
    	}
    }
    
    $use_gzipcompression = get_settings('gzipcompression');
    
    $more_wpvars = array('posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging');
    
    // Construct the query string.
    $query_string = '';
    foreach (array_merge($wpvarstoreset, $more_wpvars) as $wpvar) {
    	if ($$wpvar != '') {
    		$query_string .= (strlen($query_string) < 1) ? '' : '&';
    		$query_string .= $wpvar . '=' . rawurlencode($$wpvar);
    	}
    }
    
    $query_string = apply_filters('query_string', $query_string);
    
    update_category_cache();
    get_currentuserinfo();
    
    // Call query posts to do the work.
    $posts = & query_posts($query_string);
    
    // Extract updated query vars back into global namespace.
    extract($wp_query->query_vars);
    
    if ( is_single() || is_page() ) {
    	$more = 1;
    	$single = 1;
    }
    
    // Issue a 404 if a permalink request doesn't match any posts.  Don't issue a
    // 404 if one was already issued, if the request was a search, or if the
    // request was a regular query string request rather than a permalink request.
    if ( (0 == count($posts)) && !is_404() && !is_search()
    		&& ( isset($rewrite) || (!empty($_SERVER['QUERY_STRING']) &&
    		(false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) {
    	$wp_query->is_404 = true;
    	if ( preg_match('/cgi/', php_sapi_name()) )
    		@header('Status: 404 Not Found');
    	else
    		@header('HTTP/1.x 404 Not Found');
    }
    
    if ($pagenow != 'post.php' && $pagenow != 'edit.php') {
    	if ( get_settings('gzipcompression') ) 
    		gzip_compression();
    }
    
    // Template redirection
    if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
    	do_action('template_redirect');
    	if ( is_404() && get_404_template() ) {
    		include(get_404_template());
    		exit;
    	} else if ( file_exists(TEMPLATEPATH . "/homepage.php") ) {
    		include(TEMPLATEPATH . "/homepage.php");
    		exit;
    	}
    }
    
    endif;
    Grazie comunque dell'aiuto!
    Massimo rispetto!

  5. #5
    Utente di HTML.it
    Registrato dal
    Dec 2005
    Messaggi
    4
    UP!

  6. #6
    Utente di HTML.it
    Registrato dal
    Dec 2005
    Messaggi
    4
    UP!

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.