Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
questions about using include() in php
Old 07-19-2008, 02:54 AM questions about using include() in php
Ultra Talker

Posts: 254
Trades: 0
i am doing seo for a website and this website uses a lot of php for which i need suggestions. this is how the website is set up.

in the index.php file there is a flash banner at the top of the page and the center part is another file which is called using include("links.php") and the bottom part using include("footer.php")
the footer has links such as = webdevelopment software development ... each of this has a query string= http://website.com/index.php?page=webdevelopment and http://website.com/index.php?page=software ... etc

this way every link in the website is calling index.php and a query string is being passed and the index.php looks for the name ex=webdevelopment and loads that particular page in the center section of the website. the main purpose of doing this was to load the flash file only 1 time and the rest of the time when the links from the footer are clicked only the center part changes and the flash file does not have to reload.

due to this the entire website is having only 1 page index.php therefore using 1 <title> tag 1 meta description and 1 meta keywords tag as the values of <title> and <meta> tags are being displayed from index.php
however from a seo and sem perspective ideally there should be different file name which means i can optimize the <title> and <meta> tags for individual files.

please advice a best solution to get around this as i would like to have different title and meta tag for individual pages like webdevelopment.php software.php etc which i am presently not able to due to include("")

any help will be greatly appreciated.

thanks.
sudhakararaog is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-19-2008, 08:43 AM Re: questions about using include() in php
rezzy's Avatar
Super Talker

Posts: 115
Location: in the interwebz
Trades: 0
Hmm, sounds like quite an interesting problem.

I can only think through this problem, since I do not experince with this type of setup. I imagine you could either, remove a section of the header in index.php and move that to each page.

As far as a fancy PHP solution, I dont have that yet...
__________________

Please login or register to view this content. Registration is FREE

Resnodesigns
rezzy is offline
Reply With Quote
View Public Profile
 
Old 07-19-2008, 11:49 AM Re: questions about using include() in php
Skilled Talker

Posts: 71
Trades: 0
In the <head> of your index.php, replace the title/meta keywords with this:

PHP Code:
function make_header ($pageTitle=''$pageKeywords='') {    
        echo 
'<title>'.$pageTitle.'</title>';
        echo 
'<meta name="keywords" content="'.$pageKeywords.'" />'
    } 
Then for each page, do this:

PHP Code:
make_header ('This is your page title''these,are,some,keywords'); 
CrazeDizzleD is offline
Reply With Quote
View Public Profile
 
Old 07-19-2008, 03:43 PM accessing variable value
Ultra Talker

Posts: 254
Trades: 0
i need help with accessing the value of a variable from a different page.

i have an index.php file which has 2 files included to display header and footer and the center portion changes based on the link clicked on the footer.

header.php

<?php
echo "<h2> Text from header.php file </h2>";
?>

footer.php

<?php
$title="Title of Footer Page";
?>
<a href="index.php?page=web">Web Development</a> | <a href="index.php?page=software">Software </a>

index.php

<?php
$pagename=$_GET["page"];
$title="Index page of Company name";
?>
<html>
<head>
<title><?php echo $title; ?> </title>
<meta name="keywords" content="<?php echo $keyword; ?>">
<meta name="description" content="<?php echo $pagedescription; ?>">
</head>
<body>
<?php include("header.php"); ?> <p> </p>
<center>This is the text in the center</center> <p> </p>
<?php
if($pagename=="web")
{
include("web.php");
}
if($pagename=="software")
{
include("software.php");
}
?>
<?php include("footer.php"); ?>
</body>
</html>

whenever i click the links for Web Development or Software which appears from the footer a query string is passed to index.php I am able to display the content of web.php and software.php using the if() condition and include()
what i need to display is a different title for web.php and software.php when a user clicks Web Development along with the content i want the title of the page to change for SEO purpose. i have defined $title differently in web.php and software.php however presently the title being displayed for index.php when a user clicks web.php and software.php the title is the same
"Index page of Company name" as this is defined in index.php and my title tag is written as
<title><?php echo $title; ?> </title> however the title tag remains the same whether i click web development or software link. how change i change the code to display different titles.

i am doing this for SEO purpose so that different pages have different titles and meta tags.

actually there can be individual files with links to individual pages however the people i am dealing with who developed the website want the header and footer to remain so that a flash file does not have to load each time an individual link is clicked.

please advice.

thanks
sudhakararaog is offline
Reply With Quote
View Public Profile
 
Old 07-19-2008, 05:02 PM Re: accessing variable value
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Just alter the $title variable based on which page you are on like this:
PHP Code:
if($pagename == 'web') {
$title "Web Development";

etc.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is online now
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 07-19-2008, 09:11 PM Re: accessing variable value
Skilled Talker

Posts: 71
Trades: 0
Quote:
Originally Posted by sudhakararaog View Post
i need help with accessing the value of a variable from a different page.

i have an index.php file which has 2 files included to display header and footer and the center portion changes based on the link clicked on the footer.

header.php

<?php
echo "<h2> Text from header.php file </h2>";
?>

footer.php

<?php
$title="Title of Footer Page";
?>
<a href="index.php?page=web">Web Development</a> | <a href="index.php?page=software">Software </a>

index.php

<?php
$pagename=$_GET["page"];
$title="Index page of Company name";
?>
<html>
<head>
<title><?php echo $title; ?> </title>
<meta name="keywords" content="<?php echo $keyword; ?>">
<meta name="description" content="<?php echo $pagedescription; ?>">
</head>
<body>
<?php include("header.php"); ?> <p> </p>
<center>This is the text in the center</center> <p> </p>
<?php
if($pagename=="web")
{
include("web.php");
}
if($pagename=="software")
{
include("software.php");
}
?>
<?php include("footer.php"); ?>
</body>
</html>

whenever i click the links for Web Development or Software which appears from the footer a query string is passed to index.php I am able to display the content of web.php and software.php using the if() condition and include()
what i need to display is a different title for web.php and software.php when a user clicks Web Development along with the content i want the title of the page to change for SEO purpose. i have defined $title differently in web.php and software.php however presently the title being displayed for index.php when a user clicks web.php and software.php the title is the same
"Index page of Company name" as this is defined in index.php and my title tag is written as
<title><?php echo $title; ?> </title> however the title tag remains the same whether i click web development or software link. how change i change the code to display different titles.

i am doing this for SEO purpose so that different pages have different titles and meta tags.

actually there can be individual files with links to individual pages however the people i am dealing with who developed the website want the header and footer to remain so that a flash file does not have to load each time an individual link is clicked.

please advice.

thanks
The flash file will still have to load. Your idea that using a query string to eliminate the page reloading is wrong.

I wrote the code in my previous post some time ago to do the exact thing you're trying to do; change the title and meta keywords dynamically for each page.
CrazeDizzleD is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to questions about using include() in php
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18910 seconds with 12 queries