Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,796 members, 7,810,074 topics. Date: Friday, 26 April 2024 at 08:04 PM

How Do I Get My Page Title From Another File. - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / How Do I Get My Page Title From Another File. (687 Views)

Who Can Give My Page 4,000 Likes? / Google Page Rank Update Didn't Favor Me, Then How Can I Improve My Page Rank? / How Do I Add An Icon To My Page Title (2) (3) (4)

(1) (Reply)

How Do I Get My Page Title From Another File. by onyengbu1(m): 6:16pm On Jun 09, 2010
My page layout looks like this:

Page Header (included file)

Main page

footer (included file)

Since the header page comes before the main page, how do I get the to pull the page title from the contents from my Main page as listed above.

Putting the title on the main page doesnt work and I can put it on the header since other pages also use it.


What am I missing here.
Re: How Do I Get My Page Title From Another File. by DualCore1: 7:27pm On Jun 09, 2010
I don't understand you very well but why dont you try this page layout

(header)
(nav bar - if any)
(left or right sidebar - if any)
(main page - included file)
(footer)

This way you have everything on one page and can run a collabo of the GET method and if-elseif-else cycle in the mainpage area to include the right page that is requested for by a link.

within the nav bar you can have something like

<ul>
<li><a href="?page=home">Home</a></li>
<li><a href="?page=about">About<a></li>
<li><a href="?page=contact">Contact</a></li>
</ul>

within the main page you then have something like
<?php
if($_GET['page']=="home"wink{include('pages/home.php');}
elseif($_GET['page']=="about"wink{include('pages/about.php');}
elseif($_GET['page']=="contact"wink{include('pages/contact.php');}
else{include('pages/home.php');}
?>

With this, I am putting all my pages in a sub directory called "pages" of the root directory.
I am also putting all my content for the main page of the homepage in home.php
the last else there will load up the home.php by default, that is when a user visits the site.

Hope its clear somehow, i dont really know how to pass things accross easily but I'm hoping you've gotten my drift anyway.

I have found this method of web development a lot easier to maintain than the traditional way of having multiple pages with the same content.
Re: How Do I Get My Page Title From Another File. by onyengbu1(m): 9:38am On Jun 11, 2010
Thanks Dual Core.

I tried the one you suggested initially and it was ok until I ran into some page linking problems which I didnt try to tackle.

I will go back to it again even though it will mean a lot of work.

We are talking about re-linking close to 30 files here.

Thank you though.

(1) (Reply)

Any Complete Package(business-in-a-box) For A Newbie In Info Marketing / A Dating Site / How To Redirect A Sub Domain?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 16
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.