Title in friendly URL

-2

How do I change the title of the fixed pages in the friendly URL?

Below is the friendly url script

<div id="conteudo">
   <?php
    $url = $_GET['url'];
    $quebraUrl = explode('/', $url);                
    $categoria = $quebraUrl[0];                 
    $paginas = array('home', 'empresa', 'servicos', 'produtos', 'noticias', 'dicas', 'fale-conosco');


    //HOME
    if(!isset($categoria) || $categoria == ''){
        include("paginas/home.php");
    }
    //PAGINAS FIXAS
    else if(isset($categoria) && in_array($categoria, $paginas)){
        include("paginas/".$categoria.".php");  
    }

  ?>                   
</div>

and below the menu.php

<div id="menu">
        <ul id="categoria">
            <a href="<?php echo URLBASE; ?>/home" title="#"><li>HOME</li></a>
            <a href="<?php echo URLBASE; ?>/cursos" title="#"><li>CURSOS</li></a>
            <a href="<?php echo URLBASE; ?>/video-aulas" title="#"><li>VÍDEO AULAS</li></a>
            <a href="<?php echo URLBASE; ?>/artigos" title="#"><li>ARTIGOS</li></a>
            <a href="<?php echo URLBASE; ?>/tutoriais" title="#"><li>TUTORIAIS</li></a>
            <a href="<?php echo URLBASE; ?>/dicas" title="#"><li>DICAS</li></a>
            <a href="<?php echo URLBASE; ?>/noticias" title="#"><li>NOTÍCIAS</li></a>
            <a href="<?php echo URLBASE; ?>/fale-conosco" title="#"><li>FALE CONOSCO</li></a>
        </ul>


    </div>

and below the header.php

<?php require_once("sistema/config.php"); require_once("sistema/funcoes.php"); error_reporting(0); ?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Project WEB - Códigos, Scripts, Dicas de Programação e muito mais!</title>
<link href="<?php echo URLBASE; ?>/css/style.css" rel="stylesheet" type="text/css">
</head>

<body>
<!-- CORPO -->
<div id="corpo">

    <!-- HEADER -->
    <div id="header">
        <!-- LOGO -->
        <div id="logo">
            <a href="<?php echo URLBASE; ?>/home" title=""><img src="<?php echo URLBASE; ?>/imagens/logo.png" alt="imagens/logo.png" title="Project WEB - Códigos, Scripts, Dicas de Programação e muito mais!"></a>
        </div>

        <!-- MENU -->
        <?php include_once("includes/menu.php"); ?> 
    </div>
    
asked by anonymous 14.09.2014 / 17:38

1 answer

1

Well from what I realized, this is just a matter of logic.

In your file, config.php I believe that it is in it that you are rescuing the url, you could create a variable to contain the title.

<?php
$titulo = 'Titulo Padrao';

if($url == 'home')
   $titulo = 'Inicio';
else if($url == 'cursos')
   $titulo = 'Cursos';
?>

In the header.php file where the tag is located you would print the value of the variable.

<title><?php echo $titulo; ?></title>

It's a quick hint for your problem, but I'd advise you to work smarter by separating the "View" HTML from php codes.

Look for classes such as Smarty that can make life easier for you in structuring codes and tals.

    
15.09.2014 / 01:48