|
#1
|
|||
|
|||
|
Creating a <MENU> template object
Can anyone help me through the process of making a new template object called <MENU>, in which I can create a html menu (which includes other template tags) that will occur on all the template pages?
I don't like the idea of updating five files for every change I make in the menu, and I would really like to have the menu in just one place. I can also think of other templates to create, so this would help me a lot. Or is there any easier way to do this? Check out Pixelpost installation (and my homemade template) at http://www.baygroove.com/andreas/photos , and you will hopefully understand what I am trying to do. (note that the template is far from completed - I just discovered Pixelpost yesterday night...) |
|
#2
|
||||
|
||||
|
Nicely designed that one.
I've tested the easy way and it doesn't seem to work out. The other way is to create the menu in index.php, it'll work like you want. Please let me know what the menu should look like (as far as what are the objects you want in it) and I'll show you how it's done and you can expand on it yourself. // punk Var uppe och vandrade i somras, åkte ut från Ritsem, apropå stora sjöfallet
__________________
icq: 66760929 |
|
#3
|
|||
|
|||
|
Hey, thanks.
I'm planning to post it as a downloadable template once the work is done.I want the menu to have links to the different areas (photo, browse thumbnails, calendar archive, referers and so on), lined up as they are on the page now. The formatting is made through CSS (in /template/andreas/andreas-style.css), while the structure is very simple, something like this: Code:
<div id="menu"> <a href="index.php">Home</a> <a href="<SITE_REFLINK>">Referers</a> <a href="<IMAGE_ID>">Permalink</a> <a href="<SITE_BROWSELINK>">Thumbnails</a> <a href="index.php?x=archivecalendar">Calendar</a> <br /> <a href="http://validator.w3.org/check/referer">Valid XHTML</a> <a href="http://jigsaw.w3.org/css-validator/check/referer">Valid CSS</a> <SITE_RSS_LINK> <br /> (other template tags go here, depending on which page it is) </div> This was a bit hard to explain, hope you get the point! --Andreas (som bor i Porjus, porten till Laponia - bara ett par mil ifrån Stora Sjöfallet)
|
|
#4
|
||||
|
||||
|
Look for, close to the end of the main script, this:
// ################################################## ########################################// // END - ECHO TEMPLATE Before that add your menu-object and have it replaced in a template. Code:
$custom_menu = "
<div id='menu'>
<a href='index.php'>Home</a>
<a href='index.php?x=ref'>Referers</a>
<a href='index.php?showimage=$image_id'>Permalink</a>
<a href='index.php?x=browse'>Thumbnails</a>
<a href='index.php?x=archivecalendar'>Calendar</a>
<br />
<a href='http://validator.w3.org/check/referer'>Valid XHTML</a>
<a href='http://jigsaw.w3.org/css-validator/check/referer'>Valid CSS</a>
<a href='index.php?x=rss'>RSS 2.0</a>
<br /> * ** *
</div>
";
$tpl = ereg_replace("<MENU>",$custom_menu,$tpl);
When you add something from the available tags, you need to enter the script's real variable. Say if you want to include how many photos there are posted, do a search for the template tag <SITE_PHOTONUMBER> and you will most likely find what the variable is called in the script. $tpl = ereg_replace("<SITE_PHOTONUMBER>",$pixelpost_ph otonumb,$tpl); $pixelpost_photonumb in this case. Add that to your custom menu thing. Code:
$custom_menu = "
<div id='menu'>
<a href='index.php'>Home</a>
<a href='index.php?x=ref'>Referers</a>
<a href='index.php?showimage=$image_id'>Permalink</a>
<a href='index.php?x=browse'>Thumbnails</a>
<a href='index.php?x=archivecalendar'>Calendar</a>
<br />
<a href='http://validator.w3.org/check/referer'>Valid XHTML</a>
<a href='http://jigsaw.w3.org/css-validator/check/referer'>Valid CSS</a>
<a href='index.php?x=rss'>RSS 2.0</a>
<br />
$pixelpost_photonumb photos posted!<br />
</div>
";
$tpl = ereg_replace("<MENU>",$custom_menu,$tpl);
I think you get the hang of it. Do not use double-quotes ( " ) in here, just single-quotes instead ( ' ) otherwise you get a parse error. If you need a double-quote escape it, \" like that. In your template just use <MENU> to include it. // punk
__________________
icq: 66760929 |
|
#5
|
|||
|
|||
|
Ok! just tried it, and it works perfectly well. I will definitely be able to continue on my own from here... Thanks a lot for taking the time to explain this!
![]() --Andreas |
| Post Reply |
| Thread Tools | |
|
|