Gossamer Forum
Home : Products : DBMan : Discussions :

Make a link from ID does not work

Quote Reply
Make a link from ID does not work
Hi,

I tried to make a link from the ID-field in html.pl in sub html_record

<a href="$rec{'ID'}">link</a>

When you look at the html-output in your browser the link shows like: <B>ID_value</B><B></B>

That means $rec{'ID'} becomes <B>ID_value</B><B></B>

For example if ID is 11, then it becomes <B>11</B><B></B>

This just happens with the field ID, all other fields are working without problems. It happens in a fresh downloaded version.

What happens here?

Regards
Johannes


Quote Reply
Re: Make a link from ID does not work In reply to
What do you want to do? Please specify clearly what you want to do.



Quote Reply
Re: Make a link from ID does not work In reply to
So I try it again.

For example there is a product-database and you want to have an extra review for every product in extra html-pages. From the database you would link to these extra plain html-pages.
This pages will be ID.html
So you can put a link around the database-ID.
For example a product with ID=3 would have the review-page 3.html

To do this you have to change in sub html_record

...
print qq|
<TABLE WIDTH="475" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>ID:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'ID'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Title:</FONT></TD>
<TD> <$font>$rec{'Title'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>URL: </FONT></TD>
...

to
...
<TD WIDTH="80%"> <$font><a href="$rec{'ID'}.html">$rec{'ID'}</a></Font></TD></TR>
...


When you do this and look at the output of the database when you chooe *List all*, then there is the link at the ID. But the link goes to: <B>ID_value</B><B></B>

For the example ID=3 this means: <B>3</B><B></B>

So the URL which will load, when you click on the link is
http://www.hostname.com/path/<B>3</B><B></B>

Here is a live example:
http://212.184.209.167/db_test/
Log in as admin and choose: *List All* ...

That's more than strange.
I have it on my local computer and on the computer of my provider.
It happens also with the original dbman-demo. I don't change anything of the setup, just the things to get it running on the computer.

This happens just with the ID-field. With any other fields you don't see this problem. So why can't I use the ID-field in "" ?

Regards
Johannes

PS: Now I've seen, when you choose one record (for example ID=3) through the View-Form, than the result will be ... <B>3</B>, so the empty <B></B> is gone !?


Quote Reply
Re: Make a link from ID does not work In reply to
Please go to db.cfg file and set this variable:
$db_bold = 0;

Hope with this help,


Quote Reply
Re: Make a link from ID does not work In reply to
Turning off the bold feature is an excellent idea.

You can also add in sub html_record or sub html_record_long

the following line after:

my (%rec) = @_;

add:

$rec{'ID'} =~ s/<\/?B>//g;

You can do this for any field which would be used within a link. Including email and url links.

Hope this helps

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Make a link from ID does not work In reply to
Use the regex below to save backslashing...
Code:
$rec{'ID'} =~ s,</?B>,,g;
Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: Make a link from ID does not work In reply to
Thanks alot, all your suggestions are working fine!

Regards
Johannes