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

More footers and headers. Urgent please!!!

Quote Reply
More footers and headers. Urgent please!!!
Hey,

I need to know how to generate more footers and headers. I have done so in the table mantience but they still do not work. Help me!?!?!?

Quote Reply
Re: More footers and headers. Urgent please!!! In reply to
I need more information on what you are trying to do.
Quote Reply
Re: More footers and headers. Urgent please!!! In reply to
Thanks, what I need to do is display more ads on the page, but need to be different for each category.

I have used the <%header%> and <%footer%> tag, but I need two more. Alex told me to add some more to the category table, which I have done, but do I create a new folder in the admin in the cgi-bin to put the .txt files in or what?

Also, I need to use these in the generated pages, eg add.cgi, modify.cgi. How do I do this?

Thanks is advance,
Quote Reply
Re: More footers and headers. Urgent please!!! In reply to
Ok, any "fields" added to the Links or Category tables should be available in any template that calls them. I'd have to check specifically to see if they are available in add.cgi and modify.cgi, but to check, just look at the code and see where it calls &site_html_"anything" and see what's passed. If it passes the hash references, the tags are probably available. If it passes a list of something=>$something type parameters, they may not be. (This is just a hold-over from development and should be fixed through the next releases).

When you add a field such as Header2 to the the category table, it's now available in the templates as <%Header2%> It can be included "<%include Header2%> and used in tests, just like <%header%>

If you want to <%include%> any file, you need to put those files in the templates directory, just like the other files. If you are using page.cgi?t=nn you'd also need to put them into the nn sub-directory.

It all works the same for everything you want to do. There is really nothing "magic" in any of this, and if you follow the logic of the program you'll see what I mean. By using templates, everything works the same, and by using hashes of hashes to get the information in and out of the database, any changes are reflected automatically.

Quote Reply
Re: More footers and headers. Urgent please!!! In reply to
Thanks for your help.

I tried it and it didn't work.

Maybe if I explain it better...

At present for each category you can use <%footer%> and <%header%> tag to refer to files which are stored in the cgi-bin. I need more, this is the way I currently put advertise tags in so each category will display a different banner. As with a new design we need more tags because we have more ads.

This is all I need. I have added more names in the category table and it doesn't work.

What am I doing wrong?
Quote Reply
Re: More footers and headers. Urgent please!!! In reply to
Wait a sec.... I seem to remember that a "file" in the header/category tag is automatically parsed.

They are special cased:

In nph_build.cgi you need to change

Code:
# Get the category info.
%OUT = (); # Start with a clean hash.
$OUT{category_id} = $category_r->{'ID'};
$OUT{category_name} = $category_r->{'Name'};
$OUT{header} = $category_r->{'Header'};
$OUT{footer} = $category_r->{'Footer'};
$OUT{meta_name} = $category_r->{'Meta_Description'};
$OUT{meta_keywords} = $category_r->{'Meta_Keywords'};
$OUT{description} = $category_r->{'Description'};
$OUT{random} = rand (10000);
$OUT{random1} = rand (10000);
$OUT{random2} = rand (10000);
$OUT{random3} = rand (10000);

to include the new fields:

$OUT{header2}=$category_r->{'Header2'};

etc.

Then, a bit further down,

Code:

# Get the header and footer from file if it exists, otherwise assume it is html.
if ($OUT{header} && (length($OUT{header}) < 20) && ($OUT{header} !~ /\s+/) && (-e "$LINKS{admin_root_path}/headers/$OUT{header}")) {
open (HEAD, "<$LINKS{admin_root_path}/headers/$OUT{header}") or die "Unable to open header file: $LINKS{admin_root_path}/headers/$OUT{header}. Reason: $!";
$OUT{header} = join "", <HEAD>;
close HEAD;
}
if ($OUT{footer} && (length($OUT{footer}) < 20) && ($OUT{footer} !~ /\s+/) && (-e "$LINKS{admin_root_path}/footers/$OUT{footer}")) {
open (FOOT, "<$LINKS{admin_root_path}/footers/$OUT{footer}") or die "Unable to open footer file: $LINKS{admin_root_path}/footers/$OUT{footer}. Reason: $!";
$OUT{footer} = join "", <FOOT>;
close FOOT;
}

You need to add a new test for each of the fields you've added above:

Code:
if ($OUT{header2} && (length($OUT{header2}) < 20) && ($OUT{header2} !~ /\s+/) && (-e "$LINKS{admin_root_path}/headers/$OUT{header2}")) {
open (HEAD, "<$LINKS{admin_root_path}/headers/$OUT{header2}") or die "Unable to open header file: $LINKS{admin_root_path}/headers/$OUT{header2}. Reason: $!";
$OUT{header2} = join "", <HEAD>;
close HEAD;
}

Will probably take a few tries, but that should work now.


Quote Reply
Re: More footers and headers. Urgent please!!! In reply to
Thanks very much for your help.

I will give this a try.
Quote Reply
Re: More footers and headers. Urgent please!!! In reply to
So many solutions to this:
We have inside banners from an exchange using a link-code plus random-numbers for 0-99 as the exchange needs.
Or we used graphis with random numbers on<%random%>.gif
or use new fields or the header and footer-field with cats.
Or ...
Robert