Gossamer Forum
Home : Products : Links 2.0 : Customization :

SSI headers & footers

(Page 1 of 2)
> >
Quote Reply
SSI headers & footers
I know there have been some threads already about this, but none of it has given a solution to the problem.

I run a website, where EVERY page on the site are using SSI headers & footers. The header & footers are built as SSI so they can display changes in the website generated from the daily changes by users interactions in forums and other things happening.

So there is no other way, I realy want to include this great link manager, but if I not find a way to use my SSI headers and footers on EVERY page, I cant use it.

I am shure several people are wondering about this.
I have seen a lot of suggestions and solutions here in this forum on how to solve header and footer problem, using plain text or html,
but not anything that can give a solutin on SSI.

Are there any of you that have found a way to do this?

Any help greately appreciated.

Quote Reply
Re: SSI headers & footers In reply to
Hmmmm...seems simple enough. I just tried it using my Hypermart host and it worked without a hitch.

If you use templates, as I do, just make a folder somewhere in your html directory. Name one folder headers and the other folder footers. Create the header/footer files and name them whaqtever you like (I use .inc as the extension).
Then, in your category.html template....just place the SSI call wherever you want it to appear using something like this... [!--#include virtual="/serverroot/cgi-bin/admin/header/music.inc" --]((Note-change the brackets[] to <>...I couldn't get them to show up correctly in this post)) *Change the tag to match where you placed the folder.

You should get a header or footer wherever you want.

You can also use the Links 2.0 built-in header/footer functions quite easlily, too. Create as many header/footer files as you want.....use the admin screen to modify your categories.....add a link to your header/footer files in Add or Modify Categories.....then place the <%header%> or <%footer%> tags in your templates. Works like a charm!

Good luck.

Quote Reply
Re: SSI headers & footers In reply to
In Reply To:
Then, in your category.html template....just place the SSI call wherever you want it to appear using something like this... [] *Change the tag to match where you placed the folder.
Thanks for answer
I dont understand what you actally are saying here.
You tell me to place the [] anywhere in the category template?
Shall I use the template header and footer fields in the "Modify/Add category" page in admin panel?
Or shall I put in the actual SSI call DIRECTLY in the "Edit templates" - "category.html" like this;
[!--#include virtual="../path/to/ssi_function_file.cgi" --]?

And if I can include directly, why should I use a headers and footers directory?

Also, this will only give headers and footer in the category view, what about having headers and footers on all the other pages in the link manager, like the Home, Add a Resource, Modify a Resource,What's New, What's Cool, Top Rated, Email, Updates, Search pages?

I saw you used a call to a music.inc in the headers folder.
I cant use that way, becourse I use a "ssi_function_file.cgi" file that is located in another location, and if I move that file to the headers directory, the functions will not work. This course that file is depending on a lot of other files I have running in the other location of the website.

Can you be more specific in your instructions?


Quote Reply
Re: SSI headers & footers In reply to
I have the site organized like this:

www
www/main_site/
www/main_site/cgi-bin/
www/main_site/cgi-bin/ssi_function_file.cgi (this file interacts with a lot of other files in this cgi-bin directory, and are the SSI call to all headers in the website)
www/links (this is the link manager main dir)
www/links/pages/
www/links/admin
www/links/admin/templates

As you see, the indexfile www/links/pages/index.html must have the call to www/main_site/cgi-bin/ssi_function_file.cgi
The same goes for all files in the www/links/admin/templates

I hope you see that it will be impossible to move the ssi_function_file.cgi file to www/links/admin/header/, course it then will loose contact to all those other files located in www/main_site/cgi-bin/, required to execute its functions.

Quote Reply
Re: SSI headers & footers In reply to
The reason for the brackets is I can't get the (<) tag to display correctly in this post. I don't know what your ssi_function_file.cgi is, but I just used the basic #include call and it works fine. Put it directly in your template pages.

To get the header/footer to show up on your other pages, you simply modify those files, ie...search.html, add.html. etc.

Also, you don't actually need a header/footer directory. You should be able to call up ANY file using that SSI #include tag (if your server supports SSI). Some servers require your pages which have SSI tags to be named with the .shtml extension.

Quote Reply
Re: SSI headers & footers In reply to
I have triad to include the SSI call manualy to all the template files in www/links/admin/templates, but that will not work course the files are actually "executed" true calls from withing the add.cgi, subscribe.cgi, jump.cgi, modify.cgi, rate.cgi etc.

As I said earlier, the SSI is working perfectly on the rest of my site, my server support SSI, and I even use the "xBitHack on" instead of using shtml files.

The "xBitHack on" requires that every file containing an SSI call is chmodded +x (chmod +x index.html)
And that I have tried ofcourse, without any result to the problem.
Quote Reply
Re: SSI headers & footers In reply to
I don't know what your ssi_function_file.cgi does exactly, but couldn't you call the script itself from within the Links templates using the #exec cgi="ssi_function_file.cgi?(desired_operation) command? For instance.... #exec cgi="ssi_function_file.cgi?displayHeader ....

If your ssi_function_file logs page hits, builds mailing lists, etc....and if you're attempting to have it pull info from the Links database itself, I think you're in for an uphill climb. I'm sure it can be done, but...if that's the case...it'll take quite a bit of code tweaking.

Give us a link to your website so we can see what you're trying to do.

Quote Reply
Re: SSI headers & footers In reply to
The site is members only, and contains personal and sensitiv members information not available to the public, so I am sorry I cant give out any url.

The ssi_function_file.cgi creates and maintain the main menu navigationbar/links for the overall website. It also include code to feed the a who's online function, and pull some info from the daily changes of members interactions/postings in the messageforum.

It does not pull any info from the Links database, and is not supposed to do that in the future either.

I think the problem here, actually is that it IS NOT POSSIBLE to use SSI in Links at the moment.
It should be possible to use, even if it was only for the function of creating a header saying "This is my header".
I know for text only, one can use the header field in add/modify category template, but that should not be an argument not enabeling the possibility to use SSI if that is what the webdesigner wants to do.

Links 2.0 should be modified to enable the users to use SSI headers and footer, INDEPENDENT of what the SSI function actually does.
And that modification must enable the user to call an SSI from EVERYWHERE within the website base dir.

I think Links 2.0 must be something of the best of its type on the marked today.
But the lack of possibilities to interact with normally used webfunctions like SSI is a bad thing.
Website owners and designers cant use it, if it doesnt fit in an overall design for the website.

To bad I have a job to do. I have to make a decission to get the website running, and as it is for now i have to find other solutions.

I hope that someone will work out something, and hope that you and others keep this thread going until something is figured out.

I will be watching and hoping.

Thanks a lot for you effort trying to help.

Cheers :-)



Quote Reply
Re: SSI headers & footers In reply to
Is it just me that wants to use SSI with Links, or am I the only one that cant figure it out?

Quote Reply
Re: SSI headers & footers In reply to
Try looking at http://www.gossamer-threads.com/...w=collapsed&sb=5

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: SSI headers & footers In reply to
You can use ssi with links, you just can't use them with the cgi files. Its not a problem with Links. That happens with all perl. There are ways to incorporate ssi like functions in Links. search the forum.

Quote Reply
Re: SSI headers & footers In reply to
Perhaps your SSI-Include cgi-script contains a main-function
which you can call or integrate into the add.cgi etc. of
links or integrate it in the site_html_template.pl (which is
the parser for the templates) and redirect output of your
SSI-Script in a variable.

Something in site_html_template.pl like:

$ssiInclude = qx|/www/cgi-bin/myssiinclude.cgi|;

should work. If you take a look at site_html_template.pl you should see, how to do.

Quote Reply
Re: SSI headers & footers In reply to
In Reply To:
site_html_template.pl (which is
the parser for the templates)
Er..the parser is Template.pm Smile

Instead I suggest you installed the enhanced template sub and use
Code:
<%include filename.txt%>
which works in a similar way to SSI but can be used in cgi pages.

Mods:http://wiredon.net/gt/download.shtml
Installs:http://wiredon.net/gt/


Quote Reply
Re: SSI headers & footers In reply to
fluesopp wants to integrate dynamic not static pages! Thats her problem

and something like
$ssiinclude= qx|/www/cgi-bin/myssiinclude.cgi|;

should execute myssiinclude.cgi and fill $ssiinclude with the output of myssiinclude.cgi.
qx|foobar| works like backticks in the shell (bash as an example). Of course perl permits to use backticks, too.

Quote Reply
Re: SSI headers & footers In reply to
In Reply To:
fluesopp wants to integrate dynamic not static pages! Thats her problem
Yes I know Smile....and using <%include file.txt%> will allow her to do that.

Mods:http://wiredon.net/gt/download.shtml
Installs:http://wiredon.net/gt/


Quote Reply
Re: SSI headers & footers In reply to
Thanks sschu and PaulWilson
I will try both suggestions. Although I have some questions I will try myself first.
So give me a couple of days before I report back to you ;)

Quote Reply
Re: SSI headers & footers In reply to
Not to be totaly confused, I need to follow one suggestion at a time, so I start here:

I have installed the enhcanged template mod, and everything working ok without any SSI call.

Then I have done exactly as you say.

In the templates directory, I have made a file called file.txt
Inside that file, as the ONLY characters within, I have added the SSI call
[!--#include virtual="../../../my_ssi_function_file.cgi" --] (using <> instead of [])

The paths are as follows:

/home/username/www/cgi-bin/links/admin/templates/file.txt(this file is chmod +x, as I use the apache xBitHack On)

/home/username/www/cgi-bin/my_ssi_function_file.cgi
/home/username/www/cgi-bin/(all the other cgi files that my_ssi_function_file.cgi depends on to actually be able to to its job - display dynamic functions grabbed from all over the website)(this folder is THE heart of the whole webpage)

Now, in all my templates from the admin interface, I have added the <%include file.txt%> right under the opening <BODY> tag.
Then rebuilt all pages.

You said this would work, but it doesnt.
Nothing is changed in the browser view of the pages.
When I view the html source for the pages buildt, I only see the [!--#include virtual="../../../my_ssi_function_file.cgi" --] as pure text. It is not executed by the server.

I wonder what I have done wrong. As you see I have followed your instructions down to the smallest detail.

I have to say that the #include virtual call is working perfectly everywhere else on the website, and the path in file.txt is correct.

So what do I do now? :-))

Quote Reply
Re: SSI headers & footers In reply to
No thats not what I said.

All you've done is put an include within an include which won't work.

Your content goes _into_ file.txt. You don't put the ssi call inside it.

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: SSI headers & footers In reply to
Ok..

How do I then make the _dynamic_ output of my_ssi_fuction_file.cgi file, go into file.txt as a, still dynamic content (in a static form) :-) to be further processed and displayd as a header or footer?

Could you tell me the _exact_ procedure in code detail how to do this operation?

Quote Reply
Re: SSI headers & footers In reply to
An idea and a possible workaround? (just a though from a stupid newbie)

Let's say I make a "this_file_no_one_knows_about.html"
Within this file I place the SSI call, AND in some mysterious way get the apache server to process this file every time someone load a public known file in the website.
A following part of this process, loading the "this_file_no_one_knows_about.html" is to make the apache server write its content directly to the file.txt in the template dir. And by that way the Links executing process can see the content as STATIC, altought it is upgraded every time someone loads a page in the website

???

Please let me know if this is badly explained and I'll try to explain it further.

Could this work as an "idea" to find the workaround for this problem?

Quote Reply
Re: SSI headers & footers In reply to
Hello sschu

For the moment I guess I misses the last solution to be able to use PaulWilson's suggestion.

I have studied your suggestion here, but have to admit that I dont understand what I shall do.
I have looked in site_htm_templates, and not found any similar code as you suggest, that I can use as guideline to work this out.

Could you please explain a little furter what I have to do, to be able to try your suggestion?

Quote Reply
Re: SSI headers & footers In reply to
It was my hope that someone could find it interesting to have a look deeper into this challenge.

sschu has suggested these solutions:
$ssiinclude= qx|/www/main_site/cgi-bin/ssi_function_file.cgi|;
also
print .= qx|/www/main_site/cgi-bin/ssi_function_file.cgi|;

If one of
these lines are to be put in the site_html_templates.pl, I have the problem that IF it works, it will only generate static output that gives the situation in the time the pages are buildt within links. The content would then not be dynamic, as fresh content when someone loads the pages.
Example, the header and footer has a Whos Online function. It would not help to have the headers just output who was online the day the pages was buildt two days ago.

I use xBitHack On in apache, so there is no need for me to use .shtml. Further it is not possible to just put an ssi call in some of the template files, course all of them are loade thrue a cgi file function. So even if I manually add the SSI call to, lets say the cool.html, that will not work either.

I really hope for some help on this...otherwise I will suggest that gossamer code this script in php, as it in php are no problems with including SSI.

I have to admit that this problem are making me enourmously frustrated, as I really want the website to have the same design on every page.

Anyone able to look into this?


Quote Reply
Re: SSI headers & footers In reply to
Have you tried using whats called The Includer.cgi ??

It's a simple file that lets you call "any" file like an ssi call, using a simple javascript call. If your server doesn't support ssi, then this file acts just like it.

In search.cgi for example, the cgi generated page won't call an ssi file. So what to do? Simple..... just use a javascript call ...... and call the includer.cgi ..... and the includer.cgi will call the file like an ssi call. Understand? lol

Pretty nifty script, and works wonderful.

Here it is, just copy the codes, paste it in txt file, and rename it includer.cgi. Actually, name it anything you want. Chmod to 755, and put in cgi-bin. Whalla.



#!/usr/bin/perl

##########################################################################
## ##
## The Includer ##
## ------------ ##
## by Jimmy (wordx@hotmail.com) ##
## http://www.smartCGIs.com ##
## ##
## This is a free script, if anyone sold it to you please contact me. ##
## Please DO NOT remove any of the copyrights or links to our site, ##
## they keep this CGI free for everyone. Thanks! ##
## ##
## (c) copyright 2000 The Mp3eCom Network ##
##########################################################################
#
# Instructions:
# ============
# Grab the content of any file and display it using a Javascript tag in the following format:
#
# <script src="includer.cgi?test.txt"></script>
#
# with test.txt being the file you are grabbing.
# If it's in a different directory, include the full unix path.


$file = $ENV{'QUERY_STRING'};
print "Content-type: text/html\n\n";

if($file eq "") {
print "document.writeln('<center><font color=red>Includer Error: No File Specified.</font>
');\n";
print "document.writeln('<small>Script by <a href=\"http://www.smartcgis.com\" target=\"_blank\">SmartCGIs.com</a></small></center>');\n";
exit;
}

open(DATA,"$file") || print "document.writeln('<center><font color=red>Includer Error: Could not open $file ($!).</font>
<small>Script by <a href=\"http://www.smartcgis.com\" target=\"_blank\">SmartCGIs.com</a></small></center>');";
@filecontent = <DATA>;
close(DATA);

foreach $line(@filecontent) {
chomp($line);
$line =~ s/\'/\\\'/g;
print "document.writeln('$line');\n";
}




Calling the file:

<script src="http://www.yourdomain.com/includer.cgi?yourfile.txt"></script>

Where ever you had an ssi call on your html pages, change it to the script file on your cgi pages. Should do it. If your file is in the above directory, then just add this after cgi?../yourfile.txt.....or just put it in the same directory. Smile

Give it a try, works perfect for me. And trust me, i'm no expert.

Matter of fact...i'm about to ask a question for the big boys... another Smile

Stumppppy




Quote Reply
Re: SSI headers & footers In reply to
That's fine if you don't mind people stealing your password files and other private docs Smile

eg..<script src="includer.cgi?/etc/passwordfile"></script>

Here ya go, you can use mine and don't have to waste about 50 lines with copyright info Smile

Code:
#!/usr/bin/perl
Code:
my $inc = $ENV{'QUERY_STRING'};
print "Content-type: text/html\n\n";
Code:
&error("HACKER!") if ($inc !~ /\.(txt|htm|html)$/i);
Code:
if (!$inc) {
print qq|document.writeln('No File Specified.');|;
}

open DATA,"<$inc" || die &error($!);
while (<DATA>) {
s/'/\\'/g;
print qq|document.writeln('$_');|;
}
close DATA;
Code:
sub error {
print qq|document.writeln('Error:$_[0]');|;
exit;
}
Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: SSI headers & footers In reply to
OMG,

I never thought about that. Well, I did for a minute...and apparently the auther did too, because the new version encrypts the files. Blush

I was just to lazy to even try it with the new site I'm making. Oh joy.

Can you see if this version is better Paul? For protection purposes? You have to encrypt the files from the website where you download the new version.

If not, thanks anyway for letting me know, and everyone for that matter.

Here it is: Just a little bigger, but author states it's much safer....

http://smartcgis.com/includer/

Thanks,

StumpedAgain Wink



> >