This topic is locked
[SOLVED]

 How to present database files to web search engines?

12/9/2008 1:30:40 PM
PHPRunner General questions
L
Lorenbond author

QUESTION: What is a good method of presenting database files to the web search engines?
This question is probably out of context but maybe someone can point me in a good direction?
As it is now I have exported the data to a database.htm file where google search engine can index them.
The problem with this method is when the user clicks on the google link the entire database.html file has to load. This is a slow process! Then the user has to go to the top of the page, click a link to go to the web site, and re-enter the part number in the web site's search feature. This is to many steps and the prospect is quickly discouraged.
I can create a link directly to the view page for each item in the database.htm but that makes loading the database.htm file even slower.
Any help would be greatly appreciated.

L
Lorenbond author 12/10/2008

I've done some research and found that I can create a (site-map.xml) and (robots.txt) to list hyperlinks to the View page of each item listed in the database.
Example: http://www.MyWebPage.com/main_view.php?editid1=7059
So far I have been able to do this by exporting from msql database the ItemID's example: 7059
I then use a text editor to append the hyperlink to the itemID.
This will do but I would rather automate the work by implementing a script in php to add to the entire url of a new record to the database:
Example of what I want to do would be:
In the Before Record Added EVENT

$Values["URL"]="http://www.MyWebPage.com/main_view.php?editid1=".$data["ItemID";]
Sound good but the trouble is that The ItemID is created by the MSQL database on creation of the record and as far as I can tell does not exist during the Before record added EVENT.
Is it possible to use the after record added event and implement a quick update?
Is it possible that I'm barking up the wrong tree and there is an entirely different approach to the problem?
Any suggestions would be appreciated.

J
Jane 12/11/2008

Hi,
just set up this field as custom on the"View as" settings dialog on the Visual Editor tab.

Here is a sample code:

global $data;

$value="http://www.MyWebPage.com/main_view.php?editid1=".$data["ItemID";];

L
Lorenbond author 12/11/2008

Maybe I have not made my question clear.
QUESTION: How do I RETRIEVE and the SAVE the View Page URL: of a Record at the time the record is being created or Immediately after.

J
Jane 12/12/2008

Hi,
use After record added event for this purpose.

Here is a sample:

global $conn,$strTableName;

$strUpdate = "update ".$strTableName." set URL='http://www.MyWebPage.com/main_view.php?editid1=".$keys["ItemID"]."'; where ItemID=".$keys["ItemID"];

db_exec($strUpdate,$conn);



If key field is auto-increment you can use mysql_insert_id() function to return ID of added record:

$id = mysql_insert_id();

L
Lorenbond author 12/15/2008

Hi,

use After record added event for this purpose.

Here is a sample:
If key field is auto-increment you can use mysql_insert_id() function to return ID of added record:


Thanks, Jane

This is exactly what I was looking for! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=35998&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />

Now I can export the Item URL directly to a XML file and create my site map. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=35998&image=2&table=forumreplies' class='bbc_emoticon' alt=':D' />