Gossamer Forum
Home : Products : DBMan : Customization :

Individual posts and pages

Quote Reply
Individual posts and pages
I've just started using DBman, and realised it's a great tool for a web database. My problem is how to display the data the way i want.

I have the database set up with 1 admin account, which is the only one who can add,edit,modify etc. All other access to the database is guest only (only viewing).

But i don't want the default DBman default look, I want to choose (with html/perl code) exactly which records (and which fields in that record) to display on the guest pages. (But i would like to keep the DBman look for the admin tasks.)


IE if one of the guest pages look like this:

<html>
<head><title>My mates</title></head>
<body>
Some text...etc. etc. etc.
<table>
<tr>
<td> ID: 439 (from dbman cgi) </td>
<td> Name: Jax, John (from dbman cgi) </td>
<td> Age: 19 (from dbman cgi) </td>
</tr>
<!-- And although record 439 also contains the fields "Interests" and "Eyecolor" I don't want to show them -->
<tr>
<td> ID: 39 (from dbman cgi) </td>
<td> Name: Clay, Joe (from dbman cgi) </td>
<td> Interests: Cars (from dbman cgi) </td>
<td> Eyecolor: Blue (from dbman cgi) </td>
</tr>
<!-- And in this row I don't want to show how old (the "Age" field) Joe Clay is, even if I have it in the database -->
</table>
</body>
</html>


In other words, how do i select individual fields and records from the database. I have quite a good grasp on html, but very little knowledge of CGI and Perl, so if anybody could tell my in a easy way how to this i would be a happy man Smile
Quote Reply
Re: [Veyron] Individual posts and pages In reply to
There are several approaches (of course), the simplest is to use something like below, which is from html.pl sub html_home

Quote:
print " Admin " if ($per_admin);

Basically the print is ignored if the user has not admin status.

There are some pitfalls here if you are less than a PErl expert.

Since most of the record layout is within a print qq|
be sure to end the print qq| and restart it when inserting a
if ($per_admin)

I also had problems when the if ($per_admin) included table row tags, as then the table becomes unbalanced.

I'm sure the FAQ has more detailed information.

The other approach that I eventually went to was to use a different .pl file for admin and guest views. This way I was certain not to screwup the admin functions while playing around with the guest functions. and vicea versa
Quote Reply
Re: [Veyron] Individual posts and pages In reply to
I would also suggest checking the FAQ noted below under the sections "Fields" and "Viewing".

You may get some other ideas and option you may not have considered.

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/