SEO, XMLHTTPRequest, and YAY! My first client!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Chalks
Forum Contributor
Posts: 447
Joined: Thu Jul 12, 2007 7:55 am
Location: Indiana

SEO, XMLHTTPRequest, and YAY! My first client!

Post by Chalks »

I've been hired by my first _real_ client! However, he asked me one question I don't know the answer to and I'm stuck on one technical point as well. Can you guys help me? <3



First: I am converting his website to a database driven site. However, he was somewhat concerned about search engine results. Will a web crawler be able to index all of the articles on his site if the url is something like "display.php?article=Welcome_to_the_jungle"? Also, since the articles are changing their address (from articles/h00002.html to the latter), will they drop off google for awhile, or is there a way for me to let google and other search engines know that they're exactly the same, just named differently?


Secondly, I'm creating a fairly simple backend for him and have it pretty much completed. All he needs is a way to upload his plaintext articles (no images or anything... just the article) to the website. I want to add in a way for him to edit the articles as well. However, the way I have built admin.php, I pretty much _have_ to be able to load the article to edit without reloading the entire admin.php page. I could redesign it, but I'd much rather figure out how to use xmlhttprequest. Unfortunately, that's where I'm getting stuck.

As far as I can tell, XMLHTTPRequest is black magic. For instance, most of the tutorials I have read (including the one on this forum) have a function that has an if statement in it like so:

Code: Select all

function useHttpResponse() {
  if (http.readyState == 4) {
    doStuff();
  }
}
Yet there's never actually a call to that function (that I can see). How does it know to actually call that function? I understand creating the XMLHTTPRequest object, and I kind of understand how to call the server script that I want to run, but the latter is confusing the heck out of me.

Also, is there a way for the script you call with the XMLHTTPRequest to return more than one bit of data? Like... an article, a title, and a date?

I know there is a plethora of information about all that on this forum and other places online. I've read a whole ton of it over the past couple days, and I just can't get my head wrapped around it. Could someone explain a step by step process for calling a php file and getting data from it, and exactly what happens at each step? Thanks!
Dutchben
Forum Newbie
Posts: 12
Joined: Wed May 14, 2008 10:19 am

Re: SEO, XMLHTTPRequest, and YAY! My first client!

Post by Dutchben »

XMLHTTPRequest i have no experience with. As for your first question, if you are using Apache you can use mod_rewrite to trick search engines and use human readable URLs

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

It takes some time to studie tho
Post Reply