Author Topic: Adding Categories Menu  (Read 3808 times)

0 Members and 1 Guest are viewing this topic.

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Adding Categories Menu
« on: July 07, 2006, 11:08:17 PM »
For my site BestofWallpapers.Com, I am working on a new way of showing categories & subcategories. (Using some JavaScript)
(Like a right hand menu for Categories)

I don’t know how the current system works but my changes are working fine. Although I have to edit the file manually every time I add a new category. (I don’t how could I make it work the usual way)

Anyway, I was wondering that instead of adding this long code to all html files would it be possible to make a new html file say catmenu.html and then include it in other templates by using some tag like {catmenu}

Is it possible?  :?:
I m not a  Programmer.
          But
I m a Good Learner.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Adding Categories Menu
« Reply #1 on: July 08, 2006, 01:03:52 AM »
hmmm...lets see. try this:
[qcode]$site_template->register_vars("tag_name", $site_template->parse_template("template_name"));
[/qcode]
no .html in the template name!

You can place that line into includes/page_header.php if you want to show it on any pages.

If you want use other tags in that template, then they must be registered BEFORE parsing the template.

Good luck.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: Adding Categories Menu
« Reply #2 on: July 16, 2006, 11:02:18 PM »
Thanks V@no
The above method works just fine.

I have a little trouble in what I was trying to do before. I tried but I can’t find a solution so I am asking here to get some help.
Let me show you the java script (Basic code) that I was trying to use.
Code: [Select]
<script>
function expcol(id)
{
obj = document.getElementById(id);

if (obj.style.display == 'none')
obj.style.display = 'block';
else
obj.style.display = 'none';

}
</script>
<div onClick="expcol('span1')" style="cursor:hand;">Main Category</div>
<span id="span1" style="display:none;">
Subcategory 1<br>
Subcategory 2<br>
Subcategory 3
</span>
</span>


When someone clicks on main category, the menu expands itself and shows all the sub-categories in it.
The problem is, since category images are displayed using categories.html, the above code doesn’t show subcategories.

More precisely, I was trying to do something that you can see in this website.
HERE

Any idea if this can be done ??
I m not a  Programmer.
          But
I m a Good Learner.

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: Adding Categories Menu
« Reply #3 on: July 17, 2006, 08:29:41 PM »

More precisely, I was trying to do something that you can see in this website.
HERE


Anyone ?  :idea:
I m not a  Programmer.
          But
I m a Good Learner.