/    Sign up×
Community /Pin to ProfileBookmark

include file feeds title, meta tags to all pages – but I do not want that

took over the maintenance of a site that was very well built BUT each page calls a mutual file that places the title and meta tags. great for maintenance, fast page loading, etc. BUT, not so great if you want to personalize the meta tags (description and keywords) for each page.

So, I want to try to edit the code such that I can personalize the page to have it’s own SE specific content.

As it stands every page of the website has this php code at the start. I know exactly what this all does. And thus, each page is devoid of anything but the pages content. no head elements to tweak as they are generically called in below.

[code=php]<?php
$Session=new Session;
$thispage=$lcon14;
$noside=”noside”;
$headline=”About Us”;
start_page(“About Us”);
?>[/code]

These 2 code snippets below are the offending pieces, I think. In 1 single include file that places both the pages title and the browser title you see and adds the meta tags. That is the problem. If I start to tweak this, with my knowledge base, it breaks. I tried several obvious methods with no success. Essentially this include file fills in 4-5 key pieces of ALL of the site pages, but does that from this 1 include file. I need help to dissect this code so we can keep everything running, yet be able to change exactly what we want on each page separately. Because as it stands, we cannot.

[code=php]
/**********************************************
start_page/end_page writes html for all pages
***********************************************/
function start_page($title=””) {
global $headline;

make_header($title);
start_pagetable($headline);
}
[/code]

[code=php]
/**********************************************
make_header($title=””) writes initial html
***********************************************/
function make_header($title=””,$type=””) {
global $fhname, $addstyle, $thispage;
// $type can be used to adjust background colors or other things
$background=”#FFFFFF”; //change to background color
$title=(!empty($title))?” | $title”:”;
if (!stristr(DNAME, “admin”)) {$bodyclass=”class=”page””;}
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″ />
<title><?php echo($fhname.$title);?></title>
<meta name=”description” content=”blah blah blah” />
<meta name=”keywords” content=”blah, blah, blah” />
[/code]

thoughts?

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@etardauthorAug 18.2009 — BTW, one of the steps I tried was to naturally delete the 2 meta tags from the include file and add them to each page directly thinking it might still do it's job, and just pull in my meta tags direct from the page instead. no dice, broke the scripting and gives the error..

[COLOR="Red"]Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/sitesite/public_html/about/index.php:2) in /home/topcat/classes/Session.php on line 1[/COLOR]0
Copy linkTweet thisAlerts:
@JunkMaleAug 20.2009 — What abbout haveing the page name / page title control what is generated by using either an if()else if() conditional block (which migh turn all messy or use a switch case arrangement.

Either way, you can have a block of tags that are "Generic" to all pages and the additional specifics are added by the extra code you have.
Copy linkTweet thisAlerts:
@OctoberWindAug 20.2009 — what about storing the meta data in a database, based on the page title, then pulling them all dynamically. Since you pass $title into the function, you should be able to customize each page.
Copy linkTweet thisAlerts:
@MindzaiAug 20.2009 — Just set some variables used in the includes containing the custom info you need.
Copy linkTweet thisAlerts:
@etardauthorAug 20.2009 — Just set some variables used in the includes containing the custom info you need.[/QUOTE]

could you expand on this? not sure what you mean. maybe 1 example I could try to run with?
×

Success!

Help @etard spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...