PDA

View Full Version : How to define the same title for the entire site?


MMiz
01-14-03, 04:33 PM
Hi,

Is there any way to define a title as a variable? Lets say I want all my main sites to be "Welcome to X", but want member sites to be "Welcome to Y", and want to be able to change these without having to go through every single site. Is this possible by way of variable? CSS? Any help would be great.

-Matt

Chicken
01-14-03, 04:58 PM
I'd think php would cut the mustard, but my programming skills rank up there with my ability to assemble a car out of a ball point pen.

Living Media
01-14-03, 05:21 PM
It's not really possible with CSS - the information in the "title" tag has to all be the same; and I'm not too sure that CSS will change the contents of those based on a variable.

You could use PHP or SSI to call out a different included file for member sites and for nonmember sites. That way you have one file that contains the name of the member sites, and that same file is pulled into all member site title tags and the page is parsed before the browser sees the content; or you could use PHP to do the same thing.

The problem with that is...search engines won't know what to call your site. Google, in particular, doesn't parse includes before it swallows down the content of a page.

What you might want to think about doing is this:

* call all sites by the same title
* have a different graphic that is displayed depending on member / login status, which is the same across all sites.

You could even call a different stylesheet based on member / nonmember sites, so that when members view a site they would see one colourscheme and nonmembers would see another. You could even put some text in classes that have the style definition "display : none" on nonmember sites, so that only members could see them (as long as they were using a CSS-capable browser).

kunal
01-15-03, 08:11 AM
Hey Matt,
What are your pages currently coded in? plain html or do they have php in them? You could use PHP and use includes... shouldmnt be to hard to do..

kunal

michaeln
01-16-03, 04:27 AM
I assume your pages aren't already php.

So rename them all to *.php.

make a file called title.inc
in the file put only your title on the first line.

Your other files will look like this on the inside

<file>
<html>
<head>
<title><?PHP include('/path/to/file'); ?></title>
</head>
.
.
.
.
</file>

interactive
03-22-03, 06:23 PM
Depending on the site, what I normally do is have my header and footer files. In the header file I just add the variable in. Then in like the page thats calling it (example:index.php) I just define it before requir'ing or including the header file. Good luck

TheGAME1264
03-26-03, 08:56 PM
It can easily be done with a server-side include using ASP or PHP (as stated above), but the question I have is "why would you want to?" A title like that, while appearing to be more user-friendly, will result in a decreased ranking among search engines, particularly Google and MSN.

Never, never, never underestimate the power of search engines in acquiring new members/customers. You are much better off with a search-engine-optimized first title for each page of your site. This will allow people to find your website via the engines, and as long as you don't resort to obvious keyword stuffing (e.g. "Hosts, Web Hosts, Hosting, Web Hosting, Website Hosting, Websites Hosting, Web Site Hosting, Web Site Hosting, etc." for this site), users will still click on them as well.

If you promote your site via offline means and people find it by just typing in the domain name, they very rarely even bother to read the title anyway. They're more concerned about the content. So you can afford to make your title a little less inviting and possibly compensate by putting a welcome message in a small graphic at the top of the page or something of that nature.

etLux
03-29-03, 04:34 PM
Another neat trick is to can the whole site inside a blind frameset.

There's a tool for this over on our site with various doo-dahs like encryption, etc...

However, the essential code looks basically like this:


<HTML>
<TITLE>Your Title Here</TITLE>
<FRAMESET border=0 rows="100%,*" frameborder=0 framespacing=0>
<frame name="MainFrame" src="http://yoursite.com/index.html" scrolling=auto frameborder=no border=0 noresize>
<frame name="HiddenFrame" src="about:blank" noresize>
</FRAMESET>
</HTML>

That traps all the pages within the frameset, so the title is always the same.

TheGAME1264
04-03-03, 09:53 PM
Sites that do that irritate the hell out of me, since I like to navigate to specific pages and see the addresses of them (I like to know what languages are being used, how the designer/developer handles querystrings, things of that nature.) I don't like having to right-click on a page and click "Properties" to get the URL for a page, or "Add to Favorites" to bookmark it. I guess this is a case of "to each their own", though.

GnomeyNewt
04-04-03, 04:50 AM
Okay, what happened to good old Find & Replace feature? ... Open them all up... Click Find & Replace .. and off you go. :c) Has always worked for me. I would never load an entire site in SSI or PHP just to have the same title on every page. How often are you changing your title?

Search engine wise, using any of those niffy tricks will not get you high search engine rankings or weird ones that are all coded funny... Don't mess with your title tag or meta-tags. And if you have to, please leave your index.html page as decent as you can.