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

Possible bug? Page.cgi & HTML_Templates...

Quote Reply
Possible bug? Page.cgi & HTML_Templates...
Note this is using the latest BETA for LinkSQL.
Here is the bit of code in question:

In &clean_output look for:
Code:
# Fix up the CGI references.
$$output_ref =~ s!(<a[^>]+href\s*=\s*["']*)$LINKS{db_cgi_url}/([^"'>]+(cgi|pl)([^"'>]*))!
($begin, $url) = ($1, $2);
if ($original) {
($url =~ /\?/) ? ($output = "$begin$LINKS{db_cgi_url}/$url&$original")
: ($output = "$begin$LINKS{db_cgi_url}/$url?$original");
}
else { $output = "$begin$LINKS{db_cgi_url}/$url"; }
$output;
!eisog;



# Fix up any HTML forms, and insert hidden tags.
$$output_ref =~ s!(<form[^>]+> )!$1$form!isg;

# Fix up the HTML references
$$output_ref =~ s!(<a[^>]+href\s*=\s*["']*)$LINKS{build_root_url}/?([^"'>]*)!
($begin, $url) = ($1, $2);
if ($url =~ /\.(jpe?g|gif|cgi|pl)/) { #ADD The bolded part
$output = "$begin$LINKS{build_root_url}/$url";
}
else {
($original) ? ($output = "$1$LINKS{db_cgi_url}/page.cgi?g=" . &escape($2) . "&$original")
: ($output = "$1$LINKS{db_cgi_url}/page.cgi?g=" . &escape($2));
}

$output;
!eisog;


I know I've done a lot of hefty modifications to the scripts so, it could be something in those that is affecting my current observation. Though this is one of the subs I haven't played with and kept the modification in it. When page.cgi automatically generates it's pages....

Here is something I noticed happening with this links.pm setting:
$LINKS{build_root_url} = "http://www.mvsource.com";

http://www.mvsource.com/cgi-bin/biz/page.cgi?g=cgi-bin%2Fsubscribe.cgi%3Fd%3D1&d=1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Except for the Categories output which comes out as it should. It looks like it could be doing the first step properly for the <%db_cgi_url%> 'cgi-bin' replacements...but then because they are still in an href tag, they are getting redone by the <%build_root_url%> part, because there is no directory being used to differentiate.

With these settings:
$LINKS{build_root_url} = "http://www.mvsource.com/mv";

Everything works fine, which for me isn't going to be a problem because I don't plan on using the static pages, except for tools that search engines can index on. But I do want them to index the site so that they are pointing to the root of my site so I can redirect real visitors straight to page.cgi

Now I don't know if this will fix the problem but it might, I'd feel more comfortable if Alex verified it for me before anyone took it for granted:



I haven't tried so I'm not sure, if this is the solution...
~rl

[This message has been edited by phoule (edited March 09, 2000).]

[This message has been edited by phoule (edited March 09, 2000).]
Quote Reply
Re: Possible bug? Page.cgi & HTML_Templates... In reply to
This is a known issue. How the dynamic page serving works is it builds that page using the same routines as the static page. It then goes and tries to fix up any url's to make sure that links are still dynamic. i.e., if your static template creates a link to http://www.mysite.com/pages/New/, the program will change that to: http://www.mysite.com/cgi-bin/page.cgi?g=New/ to make sure all the links work.

The problem you are having is your Links SQL cgi-bin directory is inside of your pages directory, so it confuses the program. What you need to do is set the program to build to /pages, and keep the cgi in /cgi-bin, so the program knows what goes where.

Does that make much sense? =)

Cheers,

Alex
Quote Reply
Re: Possible bug? Page.cgi & HTML_Templates... In reply to
  
Code:
if ($url =~ /\.(jpe?g|gif|cgi|pl)/) {
By adding the cgi and pl wouldn't that mean it would skip to the next check without affecting the cgi or pl file references? At least for someone who wants to use the root htdocs as the build directory?

I say this because I figured it would append to $url being /cgi-bin/blabla.cgi the value of http://www.mvsource.com which would be the right URL?

[This message has been edited by phoule (edited March 09, 2000).]