Find jobs - Debt Consolidation - Debt Consolidation - Loan - Debt Consolidation

PDA

View Full Version : questions about using include() in php


sudhakararaog
Jul 18th 2008, 11:43 pm
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.

Dirty-Rockstar
Jul 19th 2008, 12:02 am
may not be the most ethical way of doing things but i will try to help



$page=$_GET[page];
if(isset($page)){
if($page="webdevelopment"){
include("metapage_webdevelopment.php");

}
}


^just add to it, your else could be the default index page. hope i helped a bit = )

Cri2T
Jul 19th 2008, 12:05 am
Since you already have PHP setup, you can change the title for each page based on the GET value.

IE:
$get = $_GET['page'];
<title><?=ucfirst($get)?></title>

You can replace '$get' with whatever variable is holding the value of Page. <?= is the PHP short expression to start PHP and an Echo at the same time. ucfirst() will uppercase the first letter of the string. ucwords() will uppercase the first letter of every word in a string.

Hope this helps.

Panzer
Jul 19th 2008, 1:24 am
Alternatively have variable names on all of the pages that your generating like $meta, $title - set them to the values you want for that page. Then on your main file, just have

<title><?php echo $title; ?></title>

nico_swd
Jul 19th 2008, 1:27 am
If you plan on using this method, FILTER YOUR INPUT. Users could for example add Javascript to the URL and get other user's cookies.