Gossamer Forum
Home : Products : Gossamer Links : Pre Sales :

Saving Detailpages

Quote Reply
Saving Detailpages
Hi there, i have the following job to do:

Save a detailpage not in /Detailed/ID.html

but in /Detailed/DirName/index.htm

while DirName is a new and unique field in links-table.

I know there must be a thread about this, but i cant find it in an half hour; has someone a clue how to do this?
Saving as index.htm should no problem, but i must write a new dir; hmm, somewhere must be a sub to proofe and write the Detailed-Dir, maybe i find there the right code ...

Robert

Quote Reply
Re: Saving Detailpages In reply to
In the sub build_detailed_view in the nph-build.cgi file, replace the following codes:

Code:

$filename = $LINKS{build_detail_path} . "/" . $link->{'ID'} . $LINKS{build_extension};


with the following codes:

Code:

$filename = $LINKS{build_detail_path} . "/" . $link->{'DirName'} . "/" . $link->{'ID'} . $LINKS{build_extension};


Notice the bolded codes.

Regards,

Eliot Lee

Quote Reply
Re: Saving Detailpages In reply to
Thank you Eliot,

this will fail cause you cant write ID.html to a Dir that not exists.

It should be something like:

test if dir build_detailed_path/DirName exists,
if not make dir build_detailed_path/DirName
then build the page as index.htm

Some lines above you can find:

# Create the DirName directory.
if ($LINKS{build_detail_path} =~ m,^$LINKS{build_root_path}/(.*)$,) {
&build_dir ($1);
}

So now it could be something like:

my $DirName = $LINKS{build_detail_path} . $link->{'DirName'};
if ($LINKS{build_detail_path} =~ m,^$LINKS{build_root_path}/(.*)/(.*)$,) {
&build_dir ($1);
}

I dont know if the syntax is right, but perl will say it to me just in a minute :-)


Quote Reply
Re: Saving Detailpages In reply to
Testing whether directory exists...is already in that sub...

Code:

# Create the detailed directory.
if ($LINKS{build_detail_path} =~ m,^$LINKS{build_root_path}/(.*)$,) {
&build_dir ($1);
}


Also, latter on in the sub after the line of codes I told you to replace...there is another error check:

Code:

open (DETAIL, ">$filename") or die "Unable to build detail page: $filename. Reason: $!";


With editing the line of codes I provided earlier...it should work...since all it is a matter of re-defining the $filename variable that is used to create the directories.

Regards,

Eliot


Quote Reply
Re: Saving Detailpages In reply to
Erased cause it demolish your whole directory :-(

Robert