Gossamer Forum
Home : Products : Links 2.0 : Discussions :

changing file name

Quote Reply
changing file name
I would like to change the index.html file's name that nph-build.cgi constructs to main.html. I can do that physically and have. What I really want is for the nph-build.cgi to create the home page as main.html instead of index.html. Does anyone have a suggestion on how that can be done.
Thanx


------------------
spirits
Quote Reply
Re: changing file name In reply to
Don't know why you want to do this, unless your server has been configured to use main.html as the default page in directories.

But to change the homepage from index.html to main.html, all you have to do is the following:

1) Add the following variable to your links.cfg file near the $build_index variable:

Code:
$build_home = "main.html";

2) Then in your nph-build.cgi, replace the following codes:

Code:
print qq|Building <A HREF="$build_root_url/$build_index">Home Pages</A>
. . .\n| :

under Creating Home Page in the sub build_all routine to the following:

Code:
print qq|Building <A HREF="$build_root_url/$build_home">Home Pages</A>
. . .\n| :

3) Then replace the following line of codes in the sub build_home_page routine in the nph-build.cgi script:

Code:
print "\tOpening page: $build_root_path/$build_index\n";

with the following:

Code:
print "\tOpening page: $build_root_path/$build_home\n";

4) In the same sub-routine, replace the following line of codes:

Code:
open (HOME, ">$build_root_path/$build_index") or &cgierr ("unable to open ho
me page: $build_root_path/$build_index. Reason: $!");

with the following codes:

Code:
open (HOME, ">$build_root_path/$build_home") or &cgierr ("unable to open ho
me page: $build_root_path/$build_home.
Reason: $!");

That should do it.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: changing file name In reply to
The reason for doing this is that I am using my own frames interface. On the intial openning of the files I cannot open 2 indexpages into the same window. So by having the "built" index.html changed to main. html or any othe name, I can allow the user to open my index.html and the home main.html in frames in the same window.

Made chages you suggested.
Now it does not update and gives me the following error:

CGI ERROR
==========================================
Error Message : unable to open home page: /home/spirits/public_html/links/pages/. Reason: Is a directory
Script Location : nph-build.cgi
Perl Version : 5.00503

Should I tack on the file name to the path?

------------------
spirits
Quote Reply
Re: changing file name In reply to
Uh...now...You need to change the permission of the "main.html" to 777 before building. Also, make sure that your /links/pages/ directory is set to 777 (rwxrwxrwx).

THIS is NOT a coding problem...it is a permission problem! I double checked the codes before I posted them....

BEST of luck!

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: changing file name In reply to
Good.

BTW: There may be a syntax error in the Private Mailer...I have not heard back from the people who came accross the problem of not the email messages not being sent out to the LINK OWNER.

But you may have to replace $rec{'Contact Email'} in the mailer.cgi file to $data[db_contact_email].

BTW: Point of clarification...Mods, IMHO, are stand alone scripts that function with LINKS...Code Hacks are edits of codes already in LINKS scripts. Therefore, the codes posted in this Thread is a code hack, not a Mod.

Wink

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums


[This message has been edited by AnthroRules (edited February 24, 2000).]
Quote Reply
Re: changing file name In reply to
Thank you for your help. It has been woth my time.
I belive I am trying another of your mods...... Private Mailer. I looks very promising. I do not have completely set up yet. but soon.
Thanks again

------------------
spirits