How to make page title with php

Asked

Viewed 114 times

0

How can I make this code below work as follows it works by taking in case the address of the site media/ or movies/ and the GET’s thus getting the url

ex: http://www.enderecodosite.com.br/medias/blu-ray/sobrenarutal/ http://www.enderecodosite.com.br/filmes/avi/todo-mundo-em-panico/

I’d like to make it work by staying like this

ex: http://www.enderecodosite.com.br/blu-ray/sobrenarutal/ http://www.enderecodosite.com.br/avi/todo-mundo-em-panico/

So that he knows to recognize that the 1 URL and medias and the 2 URL and movie thus making appear their corresponding titles without having to have medias/ or movies/ in the URL.

<?php //
//
//
// DESCRIÇÃO DA LISTA DE MEDIAS INICIO
$uri = $_SERVER['REQUEST_URI'];
if (strpos($uri, 'media/'.$_GET['media_categoria_url'].'/'.$_GET['media_subcategoria_url'].'/')){
$select1 = mysql_query("SELECT * FROM `media_categoria` WHERE `media_categoria_url`='".$_GET["media_categoria_url"]."'");
$dados = mysql_fetch_array($select1);
$select2 = mysql_query("SELECT * FROM `configuracoes` WHERE `funcoes`='dados'");
$dados2 = mysql_fetch_array($select2); ?>
<title><?php echo $dados2["site_titulo"]; ?> - <?php echo $dados["nome"]; ?></title>
<meta content='<?php echo $dados["site_keys"]; ?>' name='keywords'/>
<meta content='<?php echo $dados["site_descricao"]; ?>' name='description'/>
<? } // DESCRIÇÃO DA LISTA DE MEDIAS FIM
//
//
//

//
//
//
// DESCRIÇÃO DA LISTA DE MEDIAS INICIO
$uri = $_SERVER['REQUEST_URI'];
elseif (strpos($uri, 'filmes/'.$_GET['filmes_categoria_url'].'/'.$_GET['filmes_subcategoria_url'].'/')){
$select1 = mysql_query("SELECT * FROM `filmes_categoria` WHERE `filmes_categoria_url`='".$_GET["filmes_categoria_url"]."'");
$dados = mysql_fetch_array($select1);
$select2 = mysql_query("SELECT * FROM `configuracoes` WHERE `funcoes`='dados'");
$dados2 = mysql_fetch_array($select2); ?>
<title><?php echo $dados2["site_titulo"]; ?> - <?php echo $dados["nome"]; ?></title>
<meta content='<?php echo $dados["site_keys"]; ?>' name='keywords'/>
<meta content='<?php echo $dados["site_descricao"]; ?>' name='description'/>
<? } // DESCRIÇÃO DA LISTA DE MEDIAS FIM
//
//
// ?>
  • would have to do a related search in the database..

  • and how can I do that ?

1 answer

0


A good solution for what you want, it would utilize user friendly url.

No doubt it would be a solution for what you want and you can use apache url rewriting module to do this.

Since the subject is a little extensive, follows support link that will help you in this solution: Official documentation of Apache

Browser other questions tagged

You are not signed in. Login or sign up in order to post.