Ir para conteúdo
Fórum Script Brasil
  • 0

Chamar script


Guest --Jefferson --

Pergunta

Guest --Jefferson --

Quando eu chamo um script pela tag <?php include('index.php'); ?>, acontece o seguinte erro na parte superior do script (mas o resto aparece normalmente):

Warning: Cannot modify header information - headers already sent by (output started at /home/dir/public_html/index3.php:1) in /home/dir/public_html/zp-core/functions.php on line 2025

Warning: Cannot modify header information - headers already sent by (output started at /home/dir/public_html/index3.php:1) in /home/dir/public_html/index.php on line 22

Warning: Cannot modify header information - headers already sent by (output started at /home/dir/public_html/index3.php:1) in /home/dir/public_html/zp-core/functions.php on line 2025

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/dir/public_html/index3.php:1) in /home/dir/public_html/zp-core/admin-functions.php on line 9

Warning: Cannot modify header information - headers already sent by (output started at /home/dir/public_html/index3.php:1) in /home/dir/public_html/index.php on line 79

Existe algum modo de chamar o script para executar dentro do html sem ser através do include? Ou com o comando include, mas sem dar esse erro?

Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0

Provavelmente o script no index.php possui session_start() ou alguma informação de header, mas quando você o chama, você já mandou imprimir alguma coisa na tela.

O ideal é que você o chame antes de mostrar algo no navegador, ou que coloque o session_start() na página principal.

Link para o comentário
Compartilhar em outros sites

  • 0
Guest --Jefferson --

Como eu faria isso?

Eu não entendo nada de php.

O index de meu site é básico em html. Esse é o index do script

<?php

if (!defined('ZENFOLDER')) { define('ZENFOLDER', 'zp-core'); }

if (!file_exists(dirname(__FILE__) . '/' . ZENFOLDER . "/zp-config.php")) {

$dir = str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME']));

if (substr($dir, -1) == '/') $dir = substr($dir, 0, -1);

$location = "http://". $_SERVER['HTTP_HOST']. $dir . "/" . ZENFOLDER . "/setup.php";

header("Location: $location" );

}

define('OFFSET_PATH', 0);

require_once(ZENFOLDER . "/template-functions.php");

if (getOption('zenphoto_release') != ZENPHOTO_RELEASE) {

header("Location: " . FULLWEBPATH . "/" . ZENFOLDER . "/setup.php");

}

$_zp_plugin_scripts = array();

$_zp_flash_player = NULL;

$_zp_HTML_cache = NULL;

header ('Content-Type: text/html; charset= . getOption('charset'));

$obj = '';

// Display an arbitrary theme-included PHP page

// If the 'p' parameter starts with * (star) then include the file from the zp-core folder.

if (isset($_GET['p])) {

$theme = setupTheme();

$page = str_replace(array('/','\\','.'), '', sanitize($_GET['p']));

if (substr($page, 0, 1) == "*") {

$_zp_gallery_page = basename($obj = ZENFOLDER."/".substr($page, 1) . ".php");

} else {

$obj = THEMEFOLDER."/$theme/$page.php";

$_zp_gallery_page = basename($obj);

if (file_exists(SERVERPATH . "/" . $obj)) {

}

}

// Display an Image page.

} else if (in_context(ZP_IMAGE)) {

handleSearchParms($_zp_current_album->name, $_zp_current_image->filename);

$theme = setupTheme();

$_zp_gallery_page = basename($obj = THEMEFOLDER."/$theme/image.php");

// Display an Album page.

} else if (in_context(ZP_ALBUM)) {

if(isset($_GET['zipfile']) && is_dir(realpath(getAlbumFolder() . $_GET['album']))){

createAlbumZip(sanitize($_GET['album']));

} else {

if ($_zp_current_album->isDynamic()) {

$search = $_zp_current_album->getSearchEngine();

$cookiepath = WEBPATH;

if (WEBPATH == '') { $cookiepath = '/'; }

zp_setcookie("zenphoto_image_search_params", $search->getSearchParams(), 0, $cookiepath);

set_context(ZP_INDEX | ZP_ALBUM);

$theme = setupTheme();

$_zp_gallery_page = basename($obj = THEMEFOLDER."/$theme/album.php");

} else {

handleSearchParms($_zp_current_album->name);

$theme = setupTheme();

$_zp_gallery_page = basename($obj = THEMEFOLDER."/$theme/album.php");

}

}

// Display the Index page.

} else if (in_context(ZP_INDEX)) {

handleSearchParms();

$theme = setupTheme();

$_zp_gallery_page = basename($obj = THEMEFOLDER."/$theme/index.php");

}

// Load plugins, then load the requested $obj (page, image, album, or index; defined above).

if (file_exists(SERVERPATH . "/" . $obj) && $zp_request) {

foreach (getEnabledPlugins() as $extension) {

require_once(SERVERPATH . "/" . ZENFOLDER . PLUGIN_FOLDER . $extension);

}

if(!is_null($_zp_HTML_cache)) { $_zp_HTML_cache->startHTMLCache(); }

// Include the appropriate page for the requested object, and a 200 OK header.

header("HTTP/1.0 200 OK");

include($obj);

// If the requested object does not exist, issue a 404 and redirect to the theme's

// 404.php page, or a 404.php in the zp-core folder.

} else {

list($album, $image) = rewrite_get_album_image('album','image');

$_zp_gallery_page = '404.php';

$errpage = THEMEFOLDER."/$theme/404.php";

header("HTTP/1.0 404 Not Found");

if (file_exists(SERVERPATH . "/" . $errpage)) {

include($errpage);

} else {

include(ZENFOLDER. '/404.php');

}

}

$a = basename($obj);

if ($a != 'full-image.php') {

if (defined('RELEASE')) {

$official = 'Official Build';

} else {

$official = 'SVN';

}

echo "\n<!-- zenphoto version " . ZENPHOTO_VERSION . " [" . ZENPHOTO_RELEASE . "] ($official)";

if (isset($zenpage_version)) echo ' zenpage version '.$zenpage_version.' ['.ZENPAGE_RELEASE.'] ';

echo " Theme: " . $theme . " (" . $a . ") { memory: ".INI_GET('memory_limit')." } -->";

}

if(!is_null($_zp_HTML_cache)) { $_zp_HTML_cache->endHTMLCache(); }

?>

Link para o comentário
Compartilhar em outros sites

  • 0

Vejamos se eu consigo explicar:

Quando é feita uma conexão telnet pelo browser, há uma "conversa" entre ele e o servidor http, para troca de informações e coisinhas mais... Quando ele começa a ver o "texto" do html, eles param de conversar e só é recebido o texto e conteúdo do html... O que acontece é que depois que ele já começou a receber texto, ele não pode mais trocar de tela, só por javascript, pois o browser é que vai fazer a requisição e não o servidor que vai forçar o browser a mudar...

O que deve estar acontecendo: você deve ter chamado o <?php header("Location: ..."); ?> no meio da página!

Ele deve começar bem no início, sem nenhum espaço, enter ou algo mais.

Em que linguagem você programa? Quem sabe a gente pode dar uma luz melhor voltada pra tua linguagem...

E se isso não funcionar, faz a velha gambiarra:

error_reporting(0);

http://br.php.net/manual/pt_BR/function.error-reporting.php

Abraços!

Link para o comentário
Compartilhar em outros sites

  • 0

Para resumir e poupar o nosso tempo, o que eu preciso é encaixar este script ou chamá-lo (a página dele se chama "index.php"), em uma página html. Só isso. Você pode me ajudar?

Você pode montar uma página html simples com o script encaixado em uma tabela dela?

O resto, eu passo para a minha página html.

É só isso.

Link para o comentário
Compartilhar em outros sites

  • 0

Olha cara, o que tu tens que analizar: que essa tua chama de require deve estar antes de qualquer saída de texto. Só isso.

Desculpa mas eu não sei o que pode ser, como diz nosso amigo, você vai ter que debugar e/ou ler um pouco de php.

Desculpe e boa sorte!

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...