开发者

Header how to modify title of the page "on the fly"

开发者 https://www.devze.com 2022-12-30 17:18 出处:网络
My header is called as you can imagine, on each pages. it means that on ea开发者_运维问答ch pages i\'ve the same title (bad for SEO)

My header is called as you can imagine, on each pages.

it means that on ea开发者_运维问答ch pages i've the same title (bad for SEO)

Is there a workaround to set pages title outside the header.php ?

Thanks


Make a variable $page_title. Set it before including the header and in the header have something like:

echo("<title>$page_title</title>");


Set a variable for the title before including the header, then output the variable within the header.


include ('includes/header.php');
titleAndMeta('yourTitle');

This goes in your page and this goes in your header.php

function titleAndMeta($title)
 echo '<title>$title</title>';
0

精彩评论

暂无评论...
验证码 换一张
取 消