Re: Includes in Perl
by CountZero (Bishop) on Dec 09, 2007 at 20:28 UTC
|
Do you know if the hosting company supports "Server Side Includes" (or "SSI")? If so, that is probably much easier to use than to use Perl to include this "link area".You just make one file with the links and "include" it in every page through SSI. To change the links on all pages, you just have to change the links in that one file.
CountZero A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
| [reply] |
|
Yeah, according to what I am reading online they support HTML/SSL (shtml)/CGI/Perl.
If you have something I can use in SSL that would be amazing too, if you do I'm afraid you will have to write it like an idiots guide cause I'm new to the whole world of programming.
Cheers
Rachy
| [reply] |
|
| [reply] |
|
|
"SSL (shtml)"?
Secure Socket Layer (SSL) and Server Side Includes (SSI) are unrelated.
SSL is an encryption technology. Secure HTTP (HTTPS) is HTTP over SSL.
SSI allows the addition of simple dynamic aspects to HTML. Quite often, .shtml files are associated with SSI.
My fellow monks were talking about SSI.
| [reply] [d/l] |
|
|
Re: Includes in Perl
by igelkott (Priest) on Dec 09, 2007 at 20:41 UTC
|
Not a direct answer, but when using Apache, I normally use Server Side Includes (SSI) for this sort of thing. The main files are commonly named with a shtml suffix (configurable) and can include tags like <!--#include virtual="/common/header.inc--> to bring in reusable elements.
Someone else will certainly post Perl-specific solutions but you might see if this simple approach would be permitted.
Update: fixed botched link | [reply] [d/l] |
|
I tried that I get the following error an error occurred while processing this directive.
As I said I am a total code novice so I could be doing something totally obviously wrong so if you can spot something:
Have a folder called includes, in this folder is a .inc file called test which contains one line of text for the time being.
I slotted the line you gave me into my .shtml file where I want the text to appear.
Then uploaded them all onto my web space.
Any ideas?
Cheers
Rachy
| [reply] |
|
Ok it appears that I don't have SSI on the server so that would be why the script doesn't work. Thanks for your help though.
Cheers
Rachy
| [reply] |
|
Re: Includes in Perl
by Zaxo (Archbishop) on Dec 10, 2007 at 02:45 UTC
|
I think few Apache installations have SSI completely unavailable; it's probably just not switched on by default. You may be able to switch it on for yourself with an Options line in .htaccess, depending on whether the system apache config permits.
Failing that, Template Toolkit is great for creating modular text.
| [reply] |
Re: Includes in Perl
by bradcathey (Prior) on Dec 10, 2007 at 04:21 UTC
|
The good monks usually don't like suggestions like this, but I've been in a jam without the tools I need for SSI or proper CGI, so I've resorted to Java-the-script. I create an external .js with an innerHTML on the element id and then place the script tag referencing the external file wherever I need the "include" to appear. Dicey, but it works.
—Brad "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
| [reply] [d/l] |