2015-01-29 1 views
0

에 전역 변수를 할당이 내 인덱스 :내가 헤더 파일</p> <p>에 던져 클래스 코드를 생성 제목을 통과해야 인덱스

require('files/inc/config.php'); 
require('files/assets/php/header.php'); 
require('files/libs/Plantilla.class.php'); 
$plantilla = new plantilla($serv,$user,$pass,$base,$url,$sitio); 
$pagina = empty($_GET['pagina']) ? "inicio" : $general->limpiar($_GET['pagina']); 
    switch ($pagina) { 
      case 'blog': 
      $ids = $plantilla->docs($month,$view,$ref,$titles); 
      $ref = $_GET['ref']; 
      $month = $_GET['month']; 
      $view = $_GET['view']; 
      $titles = $_GET['titles']; 
      echo $ids[0]; 
      $tsTitle = $ids[1]; 
      break; 
     default: 
      echo $plantilla->docs($month,$view,$ref,$titles); 
      $ref = $_GET['ref']; 
      $month = $_GET['month']; 
      $view = $_GET['view']; 
      $titles = $_GET['titles']; 
      break; 
    } 
require('files/assets/php/footer.php'); 

변수 $ tsTitle가 header.php에 표시됩니다 및

<?php 
    $titulo = $tsTitle; 
    ?> 
<!doctype HTML> 
<html lang="es"> 
<head> 
    <title><?php echo $titulo;?></title> 

내 문제를 내가 두 파일에 표시 할 수있는 방법 footer.php 에 $ tsTitle 만 표시됩니다 footer.php?

케이스 안에 vale을 지정하십시오. $ tsTitle = $ ids [1]; 빈하지 않은

답변

0

를 이동해야합니다.

require('files/inc/config.php'); 
require('files/libs/Plantilla.class.php'); 


$plantilla = new plantilla($serv,$user,$pass,$base,$url,$sitio); 
$data_Holder = ''; 

$pagina = empty($_GET['pagina']) ? "inicio" : $general->limpiar($_GET['pagina']); 
    switch ($pagina) { 
      case 'blog': 
      $ids = $plantilla->docs($month,$view,$ref,$titles); 
      $ref = $_GET['ref']; 
      $month = $_GET['month']; 
      $view = $_GET['view']; 
      $titles = $_GET['titles']; 

      $data_Holder = $ids[0]; 

      $tsTitle = $ids[1]; 
      break; 
     default: 
      $data_Holder = $plantilla->docs($month,$view,$ref,$titles); 
      $ref = $_GET['ref']; 
      $month = $_GET['month']; 
      $view = $_GET['view']; 
      $titles = $_GET['titles']; 
      break; 
    } 

require('files/assets/php/header.php'); 
echo $data_Holder; 
require('files/assets/php/footer.php'); 
+0

감사합니다. –

0

당신은 당신의 스크립트를 조금 수정 코드 위치

require('files/inc/config.php'); 

require('files/libs/Plantilla.class.php'); 
$plantilla = new plantilla($serv,$user,$pass,$base,$url,$sitio); 
$pagina = empty($_GET['pagina']) ? "inicio" : $general->limpiar($_GET['pagina']); 
    switch ($pagina) { 
      case 'blog': 
      $ids = $plantilla->docs($month,$view,$ref,$titles); 
      $ref = $_GET['ref']; 
      $month = $_GET['month']; 
      $view = $_GET['view']; 
      $titles = $_GET['titles']; 
      echo $ids[0]; 
      $tsTitle = $ids[1]; 
      break; 
     default: 
      echo $plantilla->docs($month,$view,$ref,$titles); 
      $ref = $_GET['ref']; 
      $month = $_GET['month']; 
      $view = $_GET['view']; 
      $titles = $_GET['titles']; 
      break; 
    } 
require('files/assets/php/header.php'); 
require('files/assets/php/footer.php'); 
+0

내가 그것을했다하지만이 코드가 먼저 호출 s의 결과 http://prntscr.com/5ygip6이 경우 헤더 전에 값 에코 스위치 문에서 헤더 –

+0

입니다. –

관련 문제