1
Well I’ll try to get past what happens!
I have a php site where you have the config.php file with the following lines
<?php
$current_page_uri = $_SERVER['REQUEST_URI'];
$part_url = explode("/", $current_page_uri);
$page_name = end($part_url);
$email_id = "[email protected]";
?>
On the index.php page the following configuration
<?php
include "app/config.php";
include "app/detect.php";
if ($page_name=='') {
include $browser_t.'/index.php';
}
elseif ($page_name=='index.php') {
include $browser_t.'/index.php';
}
elseif ($page_name=='sobre.php') {
include $browser_t.'/sobre.php';
}
elseif ($page_name=='galeria.php') {
include $browser_t.'/galeria.php';
}
elseif ($page_name=='servicos.php') {
include $browser_t.'/servicos.php';
}
elseif ($page_name=='contato.php') {
include $browser_t.'/contato.php';
}
elseif ($page_name=='contato-post.php') {
include $browser_t.'/contato.php';
include 'app/contato.php';
}
else
{
include $browser_t.'/404.html';
}
?>
When I enter the regular pages as about.php
, galeria.php
the browser normally opens.
Already on the part of http://localhost/meusite/galeria.php
I have a problem, there is presented all the photos of products coming from Mysql, and has a pagination to advance the products on the pages.
When I select to advance a product page on which the link takes the page reference that is, example http://localhost/meusite/galeria.php?pagina=2
the site does not open.
If I insert in index.php the line below it works.
elseif ($page_name=='galeria.php?pagina=2') {
include $browser_t.'/galeria.php';
}
Only that I have a problem also in the search button of the site that can search the product, when I search for example code product : "6554"
when I click search I would have to open the page http://localhost/meusite/galeria_busca.php?id=6554&busca=
only it doesn’t open either, but as a test I inserted the following line in index.php and it worked.
elseif ($page_name=='galeria_busca.php?id=6554&busca=') {
include $browser_t.'/galeria_busca.php';
}
I would like the help of someone to tell me what I am doing wrong that is not opening normally without putting the search paths in index.php because I have many products and it would be impossible to create a line of code for each product code.
Any doubt I’m available.
You take the final part of the url
http://localhost/meusite/galeria.php?pagina=2
and assigns the variable$page_name
that takes on the valuegaleria.php?pagina=2
and then compares it togaleria.php
, of course it won’t work, that is, there won’t be theinclude $browser_t.'/galeria.php';
That’s what you’re doing wrong!!– user60252