3
How I can display information on my website using PHP
?
I am creating a personal website, and I want to make versions of this site in other languages.
What happens is that I need to set the domain of my site to be able to put in links.
I was wearing a include
and in the links href=""
, I put:
href="<?php include 'dominio.php'; ?>"
And inside that file domain.php had only one text: http://meusite.com
I mean, at the end of the day, it was like I was using:
href="http://meusite.com"
It would be possible to pull more than one information from a given file?
Something like that:
$dominio['brasil']=http://meusite.com.br;
$dominio['mexico']=http://meusite.com.mx;
$dominio['argentina']=http://meusite.com.ar;
And in each version I used the correct option.
Examples:
On the Brazilian website:
href="<?php $dominio['brasil']; ?>"
which is equal tohref="http://meusite.com.br"
On the Mexican website:
href="<?php $dominio['mexico']; ?>"
which is equal tohref="http://meusite.com.mx"
*I am not an expert in PHP xD
I do not know what is called this function, just know that it is commonly used to make translations of websites (which NAY is my case)
It’s just kind of like I believe it to be.
I’m not saying this is how it has to be done and I’m not saying it’s right :)
In short: A file will have to be created, and within that file will contain the information, and depending on that information, I will set the domain within my site (putting a code that will pull only certain information, in case the correct domain). In this case, each version a different domain, which is why I need this.
Thanks for the tip Thiago :) Only I’m using inside a folder, why it’s not working. I will use in another project ;) hug!
– Alexandre Lopes
Following this logic, you can use the full link path, for example
http://meusite.com.br/contato/formulario/enviar
would look like this<a href="/contato/formulario/enviar">Contato</a>
– Thiago Thaison