Hello;
this subject has been discussed many times, and I did a collation of Chris' and KurtW's work and mine.
So, we need to have a custom menu on our template's left column, and whynot another one at his footer.
We could do it by a
php include, but it brings strange problems on certain servers.
Let' do it respecting the 4images' script structure, and the sessions management.
First, let us edit the file
includes/page_header.php. Just before the closing tag
?>, let us insert this:
//---------------------------------------------------------------------------------------------
//---- Template my_menu.html ------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
$my_menu = $site_template->parse_template("my_menu");
$site_template->register_vars(array(
"my_menu" => $my_menu
));
unset($my_menu);
//---------------------------------------------------------------------------------------------
//---- Template my_footer.html ----------------------------------------------------------------
//---------------------------------------------------------------------------------------------
$my_footer = $site_template->parse_template("my_footer");
$site_template->register_vars(array(
"my_footer" => $my_footer
));
unset($my_footer);
We have created two new tags that we can now insert in each of our HTML template pages:
{my_menu} and
{my_footer}.
Let us now create the two files that will be parsed by the tags we created.
We have to create a new file in
templates/my_template/ folder, called "
my_menu.html", with this example code:
<div align="center">
<table width="100" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="center" height="17" background="{template_url}/images/button.gif" ><a href="{url_home}" style="text-decoration: none"><strong>HOME</strong></a></td>
</tr>
<tr>
<td width="100%" align="center" height="17" background="{template_url}/images/button.gif" ><a href="{url_home}?template=FAQ" style="text-decoration: none"><strong>FAQ</strong></a></td>
</tr>
<tr>
<td width="100%" align="center" height="17" background="{template_url}/images/button.gif" ><a href="{url_top_images}" style="text-decoration: none"><strong>TOP IMAGES</strong></a></td>
</tr>
<tr>
<td width="100%" align="center" height="17" background="{template_url}/images/button.gif" ><a href="{url_new_images}" style="text-decoration: none"><strong>NEW IMAGES</strong></a></td>
</tr>
</table>
</div>
<br>
As we work with the default template, you will need this picture:
Now, let us create a file
templates/my_template/my_footer.html, with this example code:
<br /><div align="center">
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<tr class="head1">
<td width="25%" align="center" class="row1"><a href="{url_contact}">Contact us</a> </td>
<td width="25%" align="center" class="row2"><a href="{url_cookies}">Cookies</a></td>
<td width="25%" align="center" class="row1"><a href="{url_terms}">Terms</a></td>
<td width="25%" align="center" class="row2"><a href="{url_wazza}">Etc...</a></td>
</tr>
</table>
</div>
That's the
my_menu display:
and that's the
my_footer display:
Keeping sessions alive:4images is a sessions based script. Every visitor has an MD5 session number, while browsing your website.
Keeping sessions alive is not so difficult:
- if you need to have a link to a core file, use links like: {url_home} to the homepage, {url_top_images}, to the top images page, and so on...
- if you install any MOD depending on a PHP file, please do this (assuming that we call this PHP file my_mod.php):
Open includes/page_header.php and find:
"url_captcha_image" => $site_sess->url(ROOT_PATH."captcha.php"),
and add after:
"url_my_mod" => $site_sess->url(ROOT_PATH."my_mod.php"),
- Then, you can link to "{url_my_mod}", without loosing your visitor's session ID.
- If you create a custom template HTML page, FAQ.html, for instance, as described here: http://www.4homepages.de/forum/index.php?topic=4996.0, you will have to link to "{url_home}?template=FAQ"
Application:Edit the file
templates/my_template/home.html and find:
{endif random_image}
insert just after:
{my_menu}
Now, find:
{footer}
and insert
before:
{my_footer}
Do the same thing in all HTML template files where you need to have your own menu displayed.
I hope that my explanation is clear enough.
Please feel free to ask about any case I could have forgotten.