Are you a Google Analytics enthusiast?
More SEO Content
Php And Title Tag
Posted 16 December 2003 - 10:42 AM
So for a page to have a title like "Shampoos, Soaps and Conditioners for Your Dog" they use a link like <a href="http://www.domain.co...&title=Shampoos, Soaps and Conditioners for Your Dog">.
That means that the address bar on the browser when a user clicks that link will read "http://www.domain.co...s for Your Dog"
A very nasty-looking URL, but does anyone think it's going to cause any problems apart from the fact that we shouldn't expect anyone to actually manually type it in?
Posted 16 December 2003 - 11:34 AM
title text on the page itself.
The less information you pass on the url, the more likely it is to get spidered.
Also, It you ever wanted to change the title text, you could do so without loosing
any links already indexed that reference the old title text.
Posted 16 December 2003 - 11:36 AM
Too thick to give any better suggestions :doh:
Posted 16 December 2003 - 11:42 AM
How would we go about doing that? I don't know if this is relevant, but there's no database here. The PHP is just cobbling the page together from a couple of files.
You would be better off passing only a title_id on the url and grabbing the
title text on the page itself.
Posted 16 December 2003 - 11:50 AM
To truly mask the long url, you could try using a blank page with a single server side include that holds the long url.
Your links could point to that file and the php document would be pulled based on what the url is in the include.
This is a good way to mask the long dynamic urls.
Posted 16 December 2003 - 12:04 PM
Posted 16 December 2003 - 12:05 PM
Just a couple of thoughts on this.
You could reference the titles via an external file using an include.
titles.inc could contain
$title="Shampoo and stuff";
$title="Dog Choc Drops";
$title="Dog worming pills";
You could then call title.inc dependant upon what the name of the variable is so that the page named page.php?name=blah&title=1 would contain a <title> tag that said <title>$title</title> which would build the title based upon whatever the title parameter in the url said. Follow?
Theres lots of ways of doing it, and I whilst I think your original example might not cause too many problems its beter sticking with known quantities.
If you don't have a 'db' so to speak, you could always work with text files and reference titles from them instead. Php has lots of handy little fuctions that enable all sorts of interactions and possibilites.
Posted 16 December 2003 - 12:11 PM
That's an interesting thought, Mike. So the page itself would really just be the <head> information, and the body would just contain the call to the include file?
There are 2 ways to interperet this question.
If you are referring to the http header then yes that will reference the .html,
but as far as the html goes, everything will come from the .php, just as it had.
If the .html file has just the single ssi in it, then all the html will come from the .php file.
Be sure your system is set up to accept the use of ssi within a .html document, not all servers are.
Posted 16 December 2003 - 12:24 PM
with dynamic content.
You might try this...
When building the link replace spaces with underscores
$title= str_replace($title, " ", "_");
You will end up with a like like
which is at least a little better then
when Building the destination page replace underscores with
$title= str_replace($title, "_", " ");
This will allow the title to display correctly.
For more information on str_replace();
Posted 16 December 2003 - 12:29 PM
Welcome to the board guys
Just a small point on John's suggestion regarding underscores. It would be better, IMO to use a hyphen, as the SE's interpret hyphens as spaces, whereas underscores are currently treated as characters.
Posted 17 December 2003 - 02:17 AM
Posted 17 December 2003 - 12:33 PM
Posted 17 December 2003 - 02:37 PM
First the use of _id and calling the title from the text suggestion made by John - how would that function be written - I've been trying to find a way to do that from the start.
The other suggestion is to use an include to show all the proper titles. The original page.php calls in html content like this:
and is written to ignore the .html extension.
Could the include file be written (and please excuse the lack of syntax)
If this is possible than all I would have to do is add the include file and the original links could all stay as they were. Let me know if I'm thinking of something that's obviously impossible. Any help with proper syntax on this also would be greatly appreciated.
Thanks for any input you can give.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users