17
I know almost nothing about PHP. Once a friend sent me a code that allowed me to separate my page into several parts and then pick up those parts again in case I change something in the scripts and style sheets, so I don’t need to go page by page to change it again, it’s about the include_once
of PHP.
Anyway, I remember I once read an article that said it’s good practice to add a title descriptive for each page of our site, for example "My site - Photoshop Tutorial".
Starting from this two information, I came across a problem. I separated my site into two parts header and footer, and I just change the main with the information I want:
<?php
include_once "./includes/header.php";
<!-- AQUI VAI MEU CONTEÚDO -->
include_once "./includes/footer.php";
?>
Only that the <title>
of the page is in the header (which is standard of all pages), and ends up being unique to the entire site. Thinking here at home I found a solution, which is to use Javascript to modify the title. I have a practice that is always put an H1 with the main subject of the site before starting the content, for example <h1>Contato</h1>
. The question is, does it influence anything on the site? Whether it’s SEO or anything else? Is there a better way to do it?
This is the code I use to change the title:
var title = $('main').first('h1').text();
$('title').text('Meu site -' + title);
You can put here the code you are using to call/open new pages?
– Sergio
I guess that’s what you wish?
<?php
 include_once "./includes/header.php";
 <!-- AQUI VAI MEU CONTEÚDO -->
 include_once "./includes/footer.php";
?>
– Wagner'