Jump to content
xisto Community
Amezis

Loading Some Of The Title From The Include Tag

Recommended Posts

Let's say I have the same PHP script on all pages, with the same menus, footer etc, but with different content. The PHP page is called "Sitename - ", and the included pages (which is in HTML) is called "Thingy". I want it to load both titles, so the title will be "Sitename - Thingy". The second page have the same PHP code (with the normal title, "Sitename - "), but is called "Why not?". This one have the title "Sitename - Why not?".Hope you understand what I want, and that you can help me. :)

Share this post


Link to post
Share on other sites

So you have a header file containing all of the content between the <head> </head> tags but you want to make it so that you can still include the file but have different content between the <title></title> tags?

 

If I am right, this is how I would do it, but it requires php:

 

Your header.php file

<html> <head>   <title> Sitename - <? echo $pagetitle; ?>   </title>  </head> <!-- Some over stuff -->

An example webpage

<? $pagetitle = "Black Widgets"; include "header.php";/* Some other stuff */?>

Now between the <title> tags on our webpage there is Sitename - Black Widgets.

 

I use the same idea on my website :)

 

Edit: Mistyped some code

Edited by cmatcmextra (see edit history)

Share this post


Link to post
Share on other sites

Great to see other people who know enough about php too :)(it may be bad for my hosting credits tho :D, gained alot by answering php qustions :D )

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.