Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

adding to page.cgi

Quote Reply
adding to page.cgi
I have managed to successfully add a couple of subs to page.cgi, but I'm confused on one thing. Around line 59 is this section:
Code:
# Figure out what to look for.
my ($new_match) = $LINKS{build_new_url} =~ m,^$LINKS{build_root_url}/(.+),o;
my ($cool_match) = $LINKS{build_cool_url} =~ m,^$LINKS{build_root_url}/(.+),o;
my ($priority_match) = $LINKS{build_root_url} =~ m,^$LINKS{build_root_url}/(.+),o;
my ($rate_match) = $LINKS{build_ratings_url} =~ m,^$LINKS{build_root_url}/(.+),o;
my ($detail_match) = $LINKS{build_detail_url} =~ m,^$LINKS{build_root_url}/(.+),o;

CASE: {
($page =~ /^$new_match/o) and do { &generate_new_page ($in); last CASE; };
($page =~ /^$cool_match/o) and do { &generate_cool_page ($in); last CASE; };
($page =~ /^$priority_match/o) and do { &generate_priority_page ($in); last CASE; };
($page =~ /^$rate_match/o) and do { &generate_rate_page ($in); last CASE; };
($page =~ /^$detail_match/o) and do { &generate_detailed_page ($in); last CASE; };
($page =~ /^\s*$/) and do { &generate_home_page ($in); last CASE; };
The $priority_match lines are the part I added in for this example. As far as I can tell, I followed the format for the other subs, but something's not right. I have tried this for the two different subs I have added to page.cgi, and in both cases, going to the "home" page.cgi page goes directly to the added sub:

http://run-down.com/...unlinks/page.cgi?d=1

This is low urgency, seeing as how I only use page.cgi for occasional testing, but it would be nice to understand what I'm doing wrong.

Thanks,
Dan

p.s. If anyone's interested, I could post the Priority Links/Page stuff as either a resource center mod or to the forum for the FAQ. The Priority Page turned out to be quite easy. In fact, I got it to work on my very first try! Smile I'll be working it into the regular site navigation shortly.

------------------
Run-Down -> Links SQL
http://run-down.com/
Quote Reply
Re: adding to page.cgi In reply to
Never mind (sort of), I just figured part of it out. After a couple of weeks wondering about this, I see it a minute after posting...

I changed:

my ($priority_match) = $LINKS{build_root_url} =~ m,^$LINKS{build_root_url}/(.+),o;

to:

my ($priority_match) = $LINKS{build_cool_url} =~ m,^$LINKS{build_root_url}/(.+),o;

(since I have the Priority page within the Cool folder.)

Now I just have to figure out how to specify a file/directory that doesn't have its own build path...

Since I've got page.cgi pointing to the home page and not the Priority page now, you can see the Priority page in its current form at:

http://run-down.com/Cool/priority.shtml

Dan
Quote Reply
Re: adding to page.cgi In reply to
Hi Dan,

What this does:

my ($priority_match) = $LINKS{build_cool_url} =~ m,^$LINKS{build_root_url}/(.+),o;

is set $priority_match = 'Cool'. What you want I think is it equal to 'Cool/priority.shtml'.

So you could just add:

($page =~ /^Cool/priority.shtml/ and do {..

to the top of the CASE list. The reason for the variables is so that we can use the same tempaltes for generated html pages and dynamic pages.

Cheers,

Alex
Quote Reply
Re: adding to page.cgi In reply to
Hi Alex,

Thanks, but that made me even more confused... Frown

I tried several variations of what I think you're saying to do, but they all result in 500 errors.

Why would the priority page be set in the CASE list? The way I follow the logic (which I barely do) is that the variables are declared with their build paths and then the CASE list points to the correct dynamic sub. Wouldn't the priority path be set in the variable, something like:

my ($priority_match) = $LINKS{build_cool_url}/priority.shtml =~ m,^$LINKS{build_root_url}/(.+),o;

That doesn't work, though, so I'm obviously wrong on some count.

Thanks,
Dan
Quote Reply
Re: adding to page.cgi In reply to
  
Quote:
I know this is off topic (because I can't figure out what you are trying to do<G> )
Is that an offer to help clear up my confusion if I can help clear up yours? Smile Where is it I lost you?

Yes, it would be nice to incorporate Amazon searches. Right now, I just have the <%query%> term passed to off-site links and search boxes. It adds convenience for users, but it would be nice to be able to present all the info in a way that matches the individual site.

I have wondered about things like Anaconda and Maxcomm (pulling Amazon search results into your own page and appending your affiliate ID for maximum commission), but I imagine Amazon frowns on their use. Lots of grey area there, but plenty to disapprove of...

Dan

[This message has been edited by Dan Kaplan (edited April 11, 2000).]
Quote Reply
Re: adding to page.cgi In reply to
I know this is off topic (because I can't figure out what you are trying to do<G> )

But, wouldn't it be great to be able to parse in Amazon.com book searches? Or, to do a search on Amazon.com and mark the ones you'd like imported as links, and have it done??

A simple concept, but not easy to implement, since Amazon keeps changing their formats, but it would make a great dynamic bookstore within the links/page.cgi formatting!

Quote Reply
Re: adding to page.cgi In reply to
I don't like the anaconda scripts, because they purposely make it impossible to make changes. Can't put a business in the hands of that sort of script.

Maxcomm is sort of behind the times.

The idea is pretty simple, but the goal would be to add the books into a Links site, so you could develop your own local database of books. You could then put the amazon code number, B&N code number, etc into the database, so that the output would generate the appropriate links for each of your affiliate programs, and give the user a choice of shopping.

In some ways it shouldn't be hard, in others it was.

Quote Reply
Re: adding to page.cgi In reply to
Thanks Alex. I haven't tried it out yet, but that makes sense. I figured I would have to add a build path into Links.pm to make it work. I was hoping to avoid that for ease of future upgrades, but it shouldn't be a big deal.

Dan
Quote Reply
Re: adding to page.cgi In reply to
What's happening here is page.cgi is looking at what is passed into the script. You'll notice if you use dynamic mode, whenever you move through your site, the url will look like:

page.cgi?g= is your home page.
page.cgi?g=Cool is your Cool page.
page.cgi?g=Cat1/Cat2 is a category page.
page.cgi?g=Detailed/5.html is a detailed page.

etc. What the program does is take your normal url like:

http://yoursite.com/pages/Cat1/Cat2

and replace that with:

page.cgi?g=Cat1/Cat2

basically stripping off the root url.

So if your priority pages are in:

http://yoursite.com/pages/Cool/priority.shtml

then the URL will look like:

page.cgi?g=Cool/priority.shtml

Now, the case statement basically looks at what g is set to, and then does the appropriate action. It's either:

Cool page
New Page
Home Page
Detailed Page

of if none of those match, it's assumed to be a category page.

So what I would do is define in Links.pm:

$LINKS{build_priority_url} = 'http://yoursite.com/pages/Cool/priority.html';

then in page.cgi:

my ($priority_match) = $LINKS{build_priority_url} =~ m,^$LINKS{build_root_url}/(.+),o;

This will set priority match equal to 'Cool/priority.html'.

Then just add into the case statement:

($page =~ /^$priority_match/o) and do { &generate_priority_page ($in); last CASE; };

and you should be set. In the first post, What I suggested was just hard coding it in, and was meant to be a quick fix. =)

Cheers,

Alex
Quote Reply
Re: adding to page.cgi In reply to
Some things just need to be in the FAQ _now_ Smile

Thanks Alex.
Quote Reply
building priority.html page In reply to
Dan,

I can't seem to get the priority.html page to build its results properly after doing the priority mod. The search works fine but I can't seem to generate the "Priority" links on the priority.html page. I really like the way you have it set up on your site. I've tried to follow this thread but haven't been able to get it to work. Would you mind posting what I need to do to get this to work properly.

Thanks so much in advance.

Mark G.

Quote Reply
Re: building priority.html page In reply to
Hi Mark,

Sorry for the slow reply. Just getting caught up on my forum reading, and I thoroughly dislike this forum's setup of not sending email notification to the originator of the thread being replied to...

It's been nearly 10 months since I looked at the Priority mod, so I might need a refresher as to what exactly needs to be done. What do you mean by the search works fine? Have you set at least one link to a priority setting in order to test the page?

I assume you have seen the instructions I put together for it?

http://run-down.com/...s_sql_priority.shtml

Dan

Quote Reply
Re: building priority.html page In reply to
Dan,

Thanks for following up. Since I wrote those comments, I got the priority mod working with Links SQL v.1.13.

Now, since Links SQL 2.0 Beta is out, would the priority mod work for it or does the mod need to be modified? I don't want to implement 2.0 on my site until there is a mod avaialble. The Beta does have some neat new features and interface.

My site is OhioBiz (www.ohiobiz.com). Feel free to take a look.

Again, thanks for the Priority mod!!

Mark Geyman

Quote Reply
Re: building priority.html page In reply to
Hi Mark,

Glad to hear you got it working. I've only taken a peek at the Next Generation demo; haven't tried installing it yet. It sounds as if the Priority mod will have to be adjusted some to work with it, but the same basic approach should still work fine (just a guess from what I've read).

Dan

Quote Reply
Re: building priority.html page In reply to
It shouldn't be too hard to make this work with the NG program. Many things are actually easier.

A few are harder, since many things done in the 1.1x version were "hacks" not real solutions :)

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ


Quote Reply
Re: adding to page.cgi In reply to
I have added in the priority plugin as found at run-down.com and it works, with the exception of actually sorting the links in the priority order. I have tried modifying the sort order in Links.pm but it doesn't seem to affect it at all. Anyone had any problems with this? Is there a work around for this or have I missed something obvious? Fraser

Quote Reply
Re: adding to page.cgi In reply to
Hmm, it certainly should sort in Priority order. Have you assigned different Priority numbers (weights) to different links? Could you post your sort order section of Links.pm here to look at?

Dan