Gossamer Forum
Home : Products : DBMan : Customization :

Post deleted by cranepaul

Quote Reply
Post deleted by cranepaul
Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
No way that I know of. Possibly with the use of javascript, but I don't know for sure.

JPD
Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
Yeah, that's what I was thinking. I've seen this done with coldfusion on sites like http://www.tolkienonline.com. That must be a feature of coldfusion.
Thanks for the reply though,
Paul

Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
I think I have found a way, using SSI...

Requirements:
- Server Side Includes
- #INCLUDE VIRTUAL permissions.

It's a bit tricky... but here's what I did:

First:
Set up your database with default user permissions.
This is important.

Second: (this is the big bit)
Make HTML that will be displaying the record. Make sure the extension
is such that your server will know it is using SSI. Normally, this is
.shtml or .shtm

This is the page where all the SSI comes into place...

Now, where you'd like the record to be displayed, place the code:
<!--#include virtual="/cgi-bin/dbman/db.cgi?db=default&uid=default&ID=$QUERY_STRING" -->

You may have to change the path to DBMan, also note the section in BOLD,
you change ID to the field name you'd like to "search" on, the value of ID is
set by our query string.

Third:
Run the page from your browser, as a test, we'll use:
http://www.yourserver.com/thepage.shtml?3

Again, take note of the BOLD sections, you will need to customise
these.

This will embed the record with an ID of 3 onto the page (in theory Wink)

If all went smoothly, you can now create the links for displaying records. The
code for a link would look something like:
<A HREF="http://www.yourserver.com/thepage.shtml?3">View Record 3</A>

----------------------------------------------------------
This method relies heavily on your webserver allowing XSSI and execute
commands. If you're sure you have these privelages, but something still
isn't working, let me know... I'm sure I've missed something Smile

- Mark

Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
Cool, I'll give it try. If it works I'll let you know.

Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
Astroboy's previous post is interesting as it will allow anyone to create a website using one page template and populating that template with data dynamically-served from DBMan.

It is one step in the "separating content from layout" direction and a simple way of having a "scripting technology" on one's website without farting around with ASP/PHP/etc.

Now, the only problem with this is that doing "http://www.yourserver.com/page.shtml?3" is all major search engines will treat the "?" as a "stop charachter" and not index either the link itself nor follow the link to see what "page.shtml?3" contains. Bummer.

So the only way I can think of is to use mod rewrite - but I don't know how to do that!

So, if anyone can think of passing a variable to the script without using "?" it would be great.

BTW "page.shtml3" won't work either as search engines won't index a page with that extension! It would have to be "page3.shtml"

Anyone any ideas because this could be a great "new" way of implementing DBMan!

Regards
David

Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
There's been various thread relating to using SSI, you might want to visit the FAQ noted in my signature, as I think I have most if not all of them referenced there.

Just choose SSI from the side menu. Perhaps one of these solutions is what you are looking for.

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
<snip>...you might want to visit the FAQ noted in my signature, as I think I have most if not all of them referenced there...Just choose SSI from the side menu. Perhaps one of these solutions is what you are looking for.
</snip>

No, there is no solution there. Read my original question again and Astroboy's post before that. The SSI itself is not the problem - calling the SSI within the page with:



works. So does:

http://www.yourserver.com/thepage.shtml?3

As I stated, using the "thepage.shtml?3" is where the problem starts. **NO** search engine will index after the "?" - my question was how to call up an article id dynamically without using the "?" - as I mentioned the Apache Mod_Rewrite was the only way I knew, then using path info, but that is a pig to do.

The problem I described remains unresolved. Thinking caps back on!

David

Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
I don't think it's possible to pass query stings without the "?". It's how your browser knows you're passing data over the web, wether to an ASP page Perl script or SSI...

Why do we want to index the query string anyway? Surely it would be better to index the front page and go from there.

- Mark

Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
>>>I don't think it's possible to pass query stings without the "?". It's how your browser knows you're passing data over the web, wether to an ASP page Perl script or SSI...

That is an incorrect understanding. Using mod_rewrite and translated Path Info, instead of writing:

http://www.site.com/index.shtml?3

You could write:

http://www.site.com/index3.shtml (for example)

and the mod_rewrite would translate this as meaning "index.shtml?3"

See http://www.apache.org/docs/mod/mod_rewrite.html for details of this

>>>Why do we want to index the query string anyway? Surely it would be better to index the front page and go from there.

Supposing you have your index page and all links of that page are in the format:

http://www.site.com/page.shtml?1
http://www.site.com/page.shtml?2
http://www.site.com/page.shtml?3

etc...

That is my original point, that NO search engine will trawl these links and index the content of the page that is "page.shtml?3"

The "?" is a "stop character" and the search engine will ignore it and not index beyond it.

Back to the problem again!

Just passing "page3.shtml" would not bing DBMan into action via SSI as the page "page3.shtml" does not exist within the file system so you would get a 404 error.

Tricky stuff.

David

Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
In Reply To:
That is an incorrect understanding. Using mod_rewrite and translated Path Info...
I stand corrected... mod_rewrite sounds interesting.. I'll have to look into that Smile

In Reply To:
Supposing you have your index page and all links of that page are in the format:

http://www.site.com/page.shtml?1
http://www.site.com/page.shtml?2
http://www.site.com/page.shtml?3

etc...

That is my original point, that NO search engine will trawl these links and index the content of the page that is "page.shtml?3"

The "?" is a "stop character" and the search engine will ignore it and not index beyond it.

Back to the problem again!

Just passing "page3.shtml" would not bing DBMan into action via SSI as the page "page3.shtml" does not exist within the file system so you would get a 404 error.
I already knew all of that... But does it really matter if the search engine doesn't "trawl" those links?

I meant "Go from there" as in the user heads over to that page then clicks on whatever link, not the search engine Smile

Besides, if your records are updated frequently, the information stored by the indexer would quickly go out of date.

- Mark

Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
>>>>I already knew all of that... But does it really matter if the search engine doesn't "trawl" those links?

Of course - don't you want all your website pages indexed by a serch engine (except those you specifically state)?

>>>I meant "Go from there" as in the user heads over to that page then clicks on whatever link, not the search engine.

But how does the user get to your website to click that link? How do you find content on the Net?

>>>>Besides, if your records are updated frequently, the information stored by the indexer would quickly go out of date.

That is what the following META tag is for:

<META name="revisit-after" content="28 days">

I apologise for the headache you will be experiencing with mod_rewrite :-)

Regards

Dave


Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
In Reply To:
But how does the user get to your website to click that link? How do you find content on the Net?
Because I just indexed that page 5 messages ago Smile

- Mark

Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
But how does the user get to your website to click that link? How do you find content on the Net?[/quote]
In Reply To:
Because I just indexed that page 5 messages ago
Hmmm...Crazy

The issue here is that any URL that is displayed on your website with a "?" in it will not be indexed by any search engin and hence unavailable in any online search engine. The fact that "you" have indexed it is of small relevance in the big scheme of things.

If search engines did not have this weakness our discussion would end with your initial suggestion...problem persistsSmile

Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
Our very first page, the page with all the links, is not a page that requires a query string.
(at least that's the assumption I've been working on Smile)

In my mind, we have a page called "main.html" which has all our links on it. If, however, this page is passed a query string, it slaps in record X from the database and there's no problem whatsoever in indexing "main.html".

- Mark

Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
In Reply To:
Our very first page, the page with all the links, is not a page that requires a query string.
(at least that's the assumption I've been working on ).....In my mind, we have a page called "main.html" which has all our links on it. If, however, this page is passed a query string, it slaps in record X from the database and there's no problem whatsoever in indexing "main.html".
Do you have a sample of the page code as I think we may be talking at crossed-purposes here!

You can email it with all the includes to davidcross@bigfoot.com and I can see we are eiether talking of different things now or you have cracked the problem :-)

The fact is thought that if you have ten links to different articles and you do not want to put in the "main.shtml?3" as the link, you would still have physically to create the page "main3.shtml" with the SSI call to DBMan in it to grab the article.

That is wasteful as you still need to have a web page for every article in your database and is little better than straight static pages!

Together we can crack this for the benefit of everyone :-)

Quote Reply
Re: Placing database data into webpage with hyperlinks In reply to
I have discovered a hack but using PHP and wondered if you know how to modify it for use with DBMan (Thanks go to "rycamor" on the devshed BBS who I quote his post below my question:

Is there a way to instruct DBMan to chop the ends off URL and request strings? SO that "page3.shtml" will get chopped to just the "3" and if request is "page322.shtml" the string will be just the "322" so the string can then be passed to DBMan as per your original suggestion all those moons ago!

Thanks
Dave

From: http://www.devshed.com/Talk/Forums/Forum15/HTML/000083.html

In httpd.conf (or with .htaccess) change the ErrorDocument 404 directive to point to a .php page (such as /content/page.php) which will parse the $REQUEST_URI variable.

Thus if the browser requests:
http://www.your_server.com/content/page4.html

This file doesn't exist, so output gets redirected through
http://www.your_server.com/content/page.php

This PHP page can simply read $REQUEST_URI, which in this case is "/content/page4.html" and manipulate it to arrive at the recordset id.

(an example using MySQL with PHP)

<?php

$pageid = substr($REQUEST_URI, 13, -5);

$db = mysql_connect("localhost", "user", "password");

$query = "SELECT * FROM pages WHERE id = $pageid";

$result = mysql_db_query("databasename", $query);

etc...
?>

The important thing to note here is the function substr(string, [start], [length]) with returns a substring of a given string starting at [start] and ending at [length], so we can take the value "/content/page4.html" start at the 13th character, and remove the last 5 characters and come back with "4", which we read as the recordset id number.
Since we use -5 as the second parameter it will remove the ".html" from the end; even if we are calling "/content/page238.html", we will end up with $pageid = 238

All the while, the original URL request still shows in the browser location bar.