Gossamer Forum
Home : Products : Links 2.0 : Customization :

Linking to the detailed page

(Page 1 of 2)
> >
Quote Reply
Linking to the detailed page
Is it possible to insert automatically a link to the detailed page?

Or even better, is it possible to have it like this:
* If there is a detailed page, link to that, but not to the jump.cgi
* If there is no detailed page, link to jump.cgi

John
Quote Reply
Re: Linking to the detailed page In reply to
Talking with myself here ... it's simple:

In the link.html template, add:
<a class="link" href="/path/to/Detailed/<%ID%>.html">Detailed Page</A>

This works if there is a detailed page for all IDs. Hmmm ... well, in this particular case of mine, there is, so I'm OK for now :-)

If anyone would know how to have the more dynamic solution I described above, please let us know.
Quote Reply
Re: Linking to the detailed page In reply to
In order to do what you want to do, you would need to add a Yes/No field to links.def; for example, isDetailed. You would use that field to say whether or not there is a detailed link for the field. Then, adjust sub site_html_link in site_html_templates.pl something like this:

Code:
my $my_link;

if ($rec{'isDetailed'} eq "Yes") {
$my_link = "$db_detailed_url/$rec{'ID'}$build_extension";
}
else {
$my_link = qq|<a class="link" href="$db_cgi_url/jump.cgi?ID=$rec{'ID'}">$rec{'Title'}</a>|;
}

Then replace the "detailed_url =>" line with:

Quote:
my_link => $my_link,

Then, in link.html, just use <%my_link%> where you want the link without worrying about whether or not it is a detailed link.

Of course, you would also need to modify nph-build.cgi to build detailed pages for the links that have isDetailed set to Yes, but not to otherwise. I'll leave that to you as an exercise in programming. Smile

[This message has been edited by Bobsie (edited May 08, 1999).]
Quote Reply
Re: Linking to the detailed page In reply to
Hi Bobsie,

you said
=========
Of course, you would also need to modify nph-build.cgi to build detailed pages
for the links that have isDetailed set to Yes, but not to otherwise.
=========

What do you mean by that? Can one build detailed only for selective links, this way?
If so, I would be interested in knowing more.

If it is just linking, then is there any need to modify nph-build.cgi? The rest of modificaiton in the above thread just within site_html_templates.pl should suffice (I think)

gotze,

Were you successful in accomplishing what you wanted?

Feedback please...
Thanks
Quote Reply
Re: Linking to the detailed page In reply to
If you had a Yes/No field defined in links.db called, for example, isDetailed, and the field is No for no detailed page and Yes if a detailed page is available, then the easiest way to build detailed pages for only those that have isDetailed set to Yes would be to change this in nph-build.cgi, sub build_detailed_view (assuming $db_isdetailed points to the isDetailed field number):

Code:
@values = &split_decode ($_);
$id = $values[$db_key_pos];

to read:

Code:
@values = &split_decode ($_);
next LINE if ($values[$db_isdetailed] eq "No");
$id = $values[$db_key_pos];

You would also need to check, in sub site_html_link (in either site_html.pl or site_html_templates.pl) whether $rec{'isDetailed'} is Yes or No and build the appropriate hyperlink based on the results. If yes, the hyperlink would point to the detailed page. If no, the hyperlink would point to the record via jump.cgi.

I hope this helps.

[This message has been edited by Bobsie (edited June 22, 1999).]
Quote Reply
Re: Linking to the detailed page In reply to
i got it to work.. it's not hard at all.. it's just now i got to add the admin feature to say if detailed is "Yes" or "No" instead of updating it by hand.. hehe

Also.. I am going to make it so it will be detailed on certain categories..
Quote Reply
Re: Linking to the detailed page In reply to
Maybe I don't fully understand the need, but in the Link template Alex provided, he uses:


Code:
<%if Details%>
<a href="<%build_detail_url%>/<%ID%>.html"><%Title%></a>
<%endif%>

<%ifnot Details%>
<a class="link" href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>"><%Title%></a>
<%endif%>


Vic
Quote Reply
Re: Linking to the detailed page In reply to
i don't use templates.. but the need is to choose for "each" link if it is detailed or not.. not the whole thing..

Smile
Jerry
Quote Reply
Re: Linking to the detailed page In reply to
Bobsie,

That's fantastic. Thank you so very much. It is working and will save me some storage space. Well, sometimes asking the same question twice definitely helps :-)

http://www.gossamer-threads.com/...um3/HTML/001635.html
====
Victor,

Here is how it works:
From what you have as in Alex's templates, it is only calling for a "detailed link" when there is one, otherwise it will link to "jump.cgi"

On the other hand, Bobsies's three line modification above in the nph-build.cgi, does not build a detailed page if you choose not to and hence will save a lot of space.

As a matter of fact, it works both ways ie. you build the detailed page only when needed and call for it in templates, if there is one.
=====

Widgetz,

As you said, now if you figure out how to build detailed only for certain categories, let us know. That is another thing I have been looking for. Also, it would be great to build these detailed pages in their seperate category directories rather than all in one directory.

Thanks everyone.
Quote Reply
Re: Linking to the detailed page In reply to
ok.. i did this in Links.def

Code:
%add_system_fields = (
isNew => 'No',
isPopular => 'No',
Hits => '0',
Rating => 0,
Votes => 0,
ReceiveMail => 'Yes',
isDetailed => \&isDetailed,
Key => 'No',
isBest => 'No'

);

sub isDetailed {
if ($in{'Category'} =~ /Software/) {
$isDetailed = "Yes";
}
else {
$isDetailed = "No";
}
return "$isDetailed";
}

hehe.. Smile

thanks!
Jerry
Quote Reply
Re: Linking to the detailed page In reply to
Victor,

In Alex's templates, the tests for <%if Details%> and <%ifnot Details%> only checks to see if detailed page building is turned on or off and is an all or nothing proposition; either all links will have detailed pages or none will.

What these folks want to do is build detailed pages for only some links, not all links. The code I posted allows them to do that.

I hope this helps.
Quote Reply
Re: Linking to the detailed page In reply to
bobsie,

can you post something else! Smile can you post how to change the default of the isDetailed from the users add thingy to "Yes" if the user submits to any category say under "Software". Smile I tried yesterday, but when I put a \&isDetailed and made a sub routine it just gave me "Detailed is too long" and Invalid Format.. that's all Smile

Thanks!
Jerry
Quote Reply
Re: Linking to the detailed page In reply to
I can't do that off the top of my head. But if you post the code you are using, perhaps we can help you figure out what is going wrong.
Quote Reply
Re: Linking to the detailed page In reply to
Ah, I see what you are trying to do. I don't think that will work and you really do not want to put things like that in links.def to begin with. It would make it too unweildly after a while. Here is how I would do it:

1. Define the isDetailed field in %db_def similar to the way the isNew field is defined.

2. Add this to %add_system_fields:

Code:
# Check to see if the record is new...
if ($new_records{$id}) {
print "\tUpdating record: $id, marking as new.\n";
$values[$db_isnew] = "Yes";
}
else {
$values[$db_isnew] = "No";
}

Add the following:

Code:
# Check to see if the record is detailed
if ($values[$db_category] =~ /Software/) {
$values[$db_isdetailed] = "Yes";
}
else {
$values[$db_isdetailed] = "No";
}

That should do it and will even change isDetailed if you move the link out of the Software category.

I hope this helps.

[This message has been edited by Bobsie (edited June 24, 1999).]
Quote Reply
Re: Linking to the detailed page In reply to
WOW! You are great Bobsie! But I have one question.. what is the easiest way to specify more than one category?

Do i have to use "&#0124; &#0124;"s? or "&&"s? or could I do it an easier way? Like..

Code:
if ($values[$db_category] =~ /Software&#0124; &#0124;Hardware/)

or something like that?? Smile also, anyway I can specify the categories from links.cfg?

Thanks alot!
Jerry
Quote Reply
Re: Linking to the detailed page In reply to
Check the code in add.cgi that uses the @db_referers variable in links.cfg. You might be able to specify the categories that way (it would just take a bit of modification to the code).
Quote Reply
Re: Linking to the detailed page In reply to
hehe.. i actually got it.. took me a few tries though.. i kept putting the else at the very end so it didn't do anything.. anyway.. if anyone is interested and they want only certain categories to have detailed links, find this in nph-build.cgi:

Code:
# Check to see if the record is new...
if ($new_records{$id}) {
print "\tUpdating record: $id, marking as new.\n";
$values[$db_isnew] = "Yes";
}
else {
$values[$db_isnew] = "No";
}

put this right after:

Code:
# Forces records in certain categories to be detailed
if (@DetailedCats) {
foreach (@DetailedCats) {
if ($values[$db_category] =~ /$_/) {
$values[$db_isdetailed] = "Yes" and last;
}
else {
$values[$db_isdetailed] = "No";
}
}
}

and in links.cfg just add:

Code:
@DetailedCats = ('detailedcat1', 'detailedcat2');

some people also want certain links in other categories to be detailed.. if you want this then just specify the link to be detailed from the admin and remove this code from the one you added in on nph-build.cgi:

Code:
else {
$values[$db_isdetailed] = "No";
}

Thanks Bobsie for all your help!
Jerry

EEk.. I Messed up! Smile I forgot to post something.. but it's all good now Smile






hopefully.. lol

[This message has been edited by widgetz (edited June 24, 1999).]

[This message has been edited by widgetz (edited October 14, 1999).]
Quote Reply
Re: Linking to the detailed page In reply to
Okay, I am definitely missing something here. The results I am getting are the following when I build the site:

Generating detailed view pages . . .
Yes Yes Yes Yes Yes Yes Yes Yes Yes No
No No No No No No No No No No
No No No No

MY WHOLE DATABASE IS NOW CORRUPTED WITH TRYING TO IMPLEMENT THESE CHANGES!

Here is a section of my database file:

No|Association for Political and Legal Anthropology|http://apla.sbc.edu/apla/|23-May-1999|Applied_Anthro/Organizations/National|The Association for Political and Legal Anthropology (APLA) is a section of the American Anthropological Association (AAA). Its members share interests in issues of contemporary importance in the fields of political and legal anthropology, including nationalism, citizenship, political and legal processes, the state, civil society, colonialism and post-colonial public spheres, multiculturalism, globalism, immigration, refugees, and media politics.|Eliot Lee|anthrotech@anthrotech.com|0|Yes|No|0|0|Yes&#0124; &#0124;&#0124; &#0124;&#0124; &#0124;&#0124; &#0124;&#0124; &#0124;
No|Bureau of Applied Research in Anthropology|http://wacky.ccit.arizona.edu/~bara/new0001.html|23-May-1999|Applied_Anthro/Organizations/National|BARA is a unique research institution that applies the principles and methods of social science toward the understanding and alleviation of real-world problems. It is integrated with the University of Arizona's Department of Anthropology and can easily facilitate multidisciplinary approaches. We can also provide a wide variety of linkages to other departments and research units in the University.|Eliot Lee|anthrotech@anthrotech.com|1|Yes|No|0|0|Yes&#0124; &#0124;&#0124; &#0124;&#0124; &#0124;&#0124; &#0124;&#0124; &#0124;
Yes|Center for Anthropology and Science Communications|http://www.concentric.net/~mpbruns/CASC/|23-May-1999|Applied_Anthro/Organizations/National|Founded in 1987, CASC (formerly CAJ, The Center for Anthropology and Journalism), has included anthropologists who have worked in a variety of media-related fields, scientific organizations that advance public understanding of science, and branches of Applied Anthropology.|Eliot Lee|anthrotech@anthrotech.com|2|No|Yes|0|0|Yes&#0124; &#0124;&#0124; &#0124;&#0124; &#0124;&#0124; &#0124;&#0124; &#0124;
No|Center for Applied Research in Anthropology|http://www.gsu.edu/~wwwgeg/cara/|23-May-1999|Applied_Anthro/Organizations/National|The Center for Applied Research in Anthropology (CARA) is the research and service arm of the Department of Anthropology and Geography. Its primary goal is to carry out theoretical and applied research on the complex social system developing in the Metropolitan Atlanta region and relating that research to wider theoretical and practical questions being developed by scientists, practitioners and policy makers in other urban settings.|Eliot Lee|anthrotech@anthrotech.com|1|Yes|No|0|0|Yes&#0124; &#0124;&#0124; &#0124;&#0124; &#0124;&#0124; &#0124;&#0124; &#0124;

You will notice that ALL IDs have been changed to No or Yes!!!!!!!

I have made the following changes in my files:

1) site_html_templates.pl

In sub site_html_link:

my $my_link;
if ($rec{'isDetailed'} eq "Yes") {
$my_link = "$db_detailed_url/$rec{'ID'}$build_extension";
}
else {
$my_link = qq|<a
href="$db_cgi_url/jump.cgi?ID=$rec{'ID'}">$rec{'Title'}</a>|;
}

2) nph-build.cgi

In sub build_detailed_view:

@values = &split_decode ($_);
next LINE if ($values[$db_isdetailed] eq "No");
$id = $values[$db_key_pos];

3) links.def

$db_isdetailed = 10;

%add_system_fields = (
isNew => 'No',
isDetailed => 'No',
Hits => '0',
Rating => 0,
Votes => 0,
ReceiveMail => 'Yes'
);

%db_select_fields = (
isNew => 'Yes,No',
isDetailed => 'Yes,No',
ReceiveMail => 'Yes,No'
);

4) link.html

<%if isDetailed%>
<a href="<%build_root_url%>/detailed/<%ID%>.shtml">
<img src="http://www.anthrotech.com/Images/review.gif" border="0" alt="Review"></a>
<%endif%>

What am I missing?

Anyone have suggestions?

Thanks.


------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited June 26, 1999).]

[This message has been edited by Eliot (edited June 26, 1999).]
Quote Reply
Re: Linking to the detailed page In reply to
Did you add the field to %db_def in links.def? Also, after adding the field, did you update your links.db to incorporate the new field in all the records?

If you have a backup, restore the links.db and try again but, this time, update links.db with the new field information. You can modify the upgrade.pl script that comes with Links v2 to do this. Or use Crisco's script located at http://www.gossamer-threads.com/...um3/HTML/001090.html to update the database.

I hope this helps.
Quote Reply
Re: Linking to the detailed page In reply to
Bobsie,

Hi there. What I did was replace "isPopular" with "isDetailed" in the %db_def.
I had to restore the file manually by retyping in the ID numbers for all records. After I replaced this, I did go into the admin.cgi and made sure that those records with Reviews had "Yes" specified in the isDetailed field (while keeping "No" for those records that do not have Reviews).

I did not think replacing the isPopular with
isDetailed would cause a problem. Since I am not using the "Popular" view, I thought it would not be a problem to replace it with "isDetailed".

I will try your suggestion and see if it works.

Thanks.

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Linking to the detailed page In reply to
You can't just rename isPopular to isDetailed. There is too much code all over the scripts that looks at that field. You should just add a new field for isDetailed. If you are not using isPopular, there are many things in nph-build.cgi (and other scripts) that need to be removed or deactivated, otherwise they will affect that field.

[This message has been edited by Bobsie (edited June 27, 1999).]
Quote Reply
Re: Linking to the detailed page In reply to
Thanks, Bobsie.

IT worked. (I added a field, "isDetailed" and it worked.)

Also, that upgrade.pl works great.
I will keep that file for future use.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Linking to the detailed page In reply to
Okay....
I can add the fields to the data base
but i have a request
i dont want to put the option to have the deailed page that will hold the reviews on it, on the add.cgi form cause i am sure that nearly every site that signs up will want t review so can i make another form that request the review but writes to the new field in the origninal data base

if confused


1)you add your site
2) you browse the site and realsie that some sites are reviewed
3)you click on the review my site link!
4)takes you to reviewme.cgi
5)form is submitted to web admin
6)web admin takes the option to either do a review or reject the request
7)whether or not you are reviewed or not you get an e-mail stating what is happeneing
8)if yes web admin gets a form to put in his review of th site
9)builds all
10)Editors pick icon is now placed next to persons link
11)editors pick , when clicked goes to the detailed page!

Hope that clears it up!
Quote Reply
Re: Linking to the detailed page In reply to
Guys,
I'm not a perl expret, so im getting a bit confused here. I tried the first couple of steps up till Bobsie's second post, i did that , and then aaccessed my admin, when i viewed the links to see if the (isDetailed) field is there and to try if its working, when i viewd All, i got the following:

the first link in the list looked normal till i looked at the field (isDetailed) it is supposed to be empty , but it had the ID of the next link in the list,
when i looked at the next link ; in the ID field, it had the Title, and in the password field, it had the ID of the link below it, and in the isDetailed field, it had the Title of the link below...... and so one, all the data seemd to be shifted one step up with each lin and mixed together.

i checked my Links.def and made sure i had my numbers in sequesnce :
here it is :

# Database Definition: LINKS
# --------------------------------------------------------
# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Title => [1, 'alpha', 40, 75, 1, '', ''],
URL => [2, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp'],
Date => [3, 'date', 15, 15, 1, \&get_date, ''],
Category => [4, 'alpha', 0, 150, 1, '', ''],
Description => [5, 'alpha', '40x3', 500, 0, '', ''],
'Contact Name' => [6, 'alpha', 40, 75, 1, '', ''],
'Contact Email' => [7, 'alpha', 40, 75, 1, '', '.+@.+\..+'],
Hits => [8, 'numer', 10, 10, 1, '0', '\d+'],
isNew => [9, 'alpha', 0, 5, 0, 'No', ''],
isPopular => [10, 'alpha', 0, 5, 0, 'No', ''],
Rating => [11, 'numer', 10, 10, 1, 0, '^[\d\.]+$'],
Votes => [12, 'numer', 10, 10, 1, 0, '^\d+$'],
Reviews => [13, 'numer', 10, 10, 1, 0, '^\d+$'],
ReceiveMail => [14, 'alpha', 10, 10, 1, 'Yes', 'No|Yes'],
Graphic => [15, 'alpha', 40, 75, 0, '', ''],
Gwidth => [16, 'alpha', 5, 5, 0, '', ''],
Gheight => [17, 'alpha', 5, 5, 0, '', ''],
Priority => [18, 'alpha', 0, 5, 1, 'No', 'No|Yes'],
Password => [19, 'alpha', 10, 10, 1, '', ''],
isDetailed => [20, 'alpha', 0, 5, 1, 'No', 'No|Yes']
);

# Database file to use -- defined in links.cfg.
$db_file_name = $db_links_name;
# Counter file to use -- defined in links.cfg.
$db_id_file_name = $db_links_id_file_name;
# The column name for the database key.
$db_key = 'ID';
# Database delimeter.
$db_delim = '|';
# Title used in admin output.
$html_title = 'Links Database';
$html_object = 'Link';

# Field Number of some important fields. The number is from %db_def above
# where the first field equals 0.
$db_priority = 18; $db_password = 19; $db_isDetailed = 20;
$db_category = 4; $db_modified = 3; $db_url = 2;
$db_hits = 8; $db_isnew = 9; $db_ispop = 10;
$db_contact_name = 6; $db_contact_email = 7; $db_title = 1;
$db_votes = 12; $db_rating = 11; $db_reviews = 13;
$db_mail = 14;
# Field number to sort links by:
$db_sort_links = 1;

# Field names you want to allow visitors to search on:
@search_fields = (1,2,5);

# System defaults. When adding new links or modifying links, these fields
# can not be overwritten by a user.
%add_system_fields = (
isNew => 'No',
isPopular => 'No',
Hits => '0',
Priority => 'No',
Rating => 0,
Votes => 0,
ReceiveMail => 'Yes',
Reviews => '0'
);

# Hash of column names to possible options. If you want to use a select form
# field, you can use &build_select_field in your HTML page. This routine will
# make a <SELECT> input tag using the following values:
%db_select_fields = (
isNew => 'Yes,No',
isPopular => 'Yes,No',
ReceiveMail => 'Yes,No',
Priority => 'Yes,No'
);

# Hash of column names to radio values. If you use &build_radio_field, it will
# make a <INPUT TYPE="RADIO"> tag for you using the options specified in the hash.
%db_radio_fields = ( );

# Maximum number of hits returned in a search. Can be overridden in the search
# options.
$db_max_hits = 10;

# Use the built in key tracker.
$db_key_track = 1;

# ===========================================================================
# Build up some variables from your definitions. Internal use only.
@db_cols = ();
foreach (sort { $db_def{$a}[0] <=> $db_def{$b}[0] } keys %db_def) {
push (@db_cols, $_);
$db_sort{$_} = $db_def{$_}[1];
$db_form_len{$_} = $db_def{$_}[2];
$db_lengths{$_} = $db_def{$_}[3];
$db_not_null{$_} = $db_def{$_}[4];
$db_defaults{$_} = $db_def{$_}[5];
$db_valid_types{$_} = $db_def{$_}[6];
($_ eq $db_key) and $db_key_pos = $db_def{$_}[0];
}

1;

----------
in the end, can someone post a description of exactly what this mod can do, and maybe a link an example where they inplemented it .

Thanx
Quote Reply
Re: Linking to the detailed page In reply to
I don't have a link for an example, but the purpose of this mod (as I remember it) was to allow building of detailed view pages for specific links instead of all links. In other words, you can keep the $build_detailed in links.cfg set to 0 and still have detailed views for some links.

The problem you describe with your database sounds to me like you didn't update your database to include the new field after changing links.def.

I hope this helps.
> >