Welcome to Geeklog, Anonymous Wednesday, December 04 2024 @ 02:44 pm EST

Geeklog Forums

Block Creation


Whoosh

Anonymous
dizzy
I'm trying to create a tree menu block for GL. I don't wish to use the menuplugin because it requires I set up topics when I just wish to have a bunch of options and suboptions that will display staticpages and forms. (I tried using the menu plugin and after about 50 topics and subtopics I just had a big administrative mess.)

I have the tree code done (modified some existing public domain code). It works fine, independent of GL. When I put it in index.php it also works, but unfortunately it shows up in the place where articles display (this happens because I put the code after the header is displayed. The header displays leftblocks and my code is not yet set up as a left block).

Just as a test, I put my code in a function within lib-common.php (like the COM_userMenu function). I also added a " menu_block" block entry in the blocks table. Finally, I added a case entry to COM_showblock so that my function will be called when lib-common is included.

When I ran GL, my menu block showed up. It looked just grand. The URLs seem to be set properly for each entry. Unfortunately, when I clicked to expand an entry, nothing seemed to happen. Control needs to get back to my function and I don't think that this is happening.

I am wondering if anyone might have some help here for me based upon what I have said. I'd pay for someone to do this, but I really want to do it myself (tired of GL being such a blackbox to me).

Hope somebody can help a bit.

Thanks!
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
Does this menu have a form and your posting or are these just links. You can do both but i'm assuming these are links. I'd verify that you are posting correct HTML <a> tags for the links.

If you have a function defined in lib-custom and it returns proper formated HTML and not echoing it out. Then you can just create a php block in the editor and call it. You won't have to modify COM_showBlock() or manually add it to the blocks table.
Geeklog components by PortalParts -- www.portalparts.com
 Quote

Whoosh

Anonymous
Thanks for your reply, Blaine. About a month or so ago I had a wicked problem (at least for me) and you helped. I finally got that problem solved and learned buckets.

Basically I have a simple flat file that stores my menu entries and targets in a heirarchy. The target can be anything, a link to another php file (staticpage, a form, etc.) or a file to be downloaded, etc. The code expands and collapses the menu based upon the contents of the flat file.

Currently, the html is all being stored in a variable $retval. As I said, when I put the code in index.php, it works just fine - only it shows in the article display region instead of in a leftblock. So I know the code at least returns good html.

Okay. I'll look into creating a php block. I was hoping to modify the GL core so that I could learn how it is all put together. I am just amazed by it. As you know, I'm pretty new to PHP. So I have never seen anything like this before.

Two last questions: are there any performance, security (or other) issues with which I should be concerned if I create the php block and call it? And are you still coding for hire? I may get in too deep and want someone to code and comment this so that I can learn it. Rolling Eyes

Thanks!
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
Quote by Whoosh: Two last questions: are there any performance, security (or other) issues with which I should be concerned if I create the php block and call it? And are you still coding for hire? I may get in too deep and want someone to code and comment this so that I can learn it. Rolling Eyes
Thanks!

Woosh, I think on large sites you need to be more careful about the SQL calls and amount of data your handling but smaller sites can get away with a lot more. I've also seen performance issues with large javascript functions sorting thousands of elements. But in most cases, you can do quite a bit server side and get away with resonable performance.

I'm always interested in doing custom work or assisting on projects. I've had a few clients recently that needed a few hours of support to be more self sufficient and they were pleased and felt it was well worth it.
Geeklog components by PortalParts -- www.portalparts.com
 Quote

Whoosh

Anonymous
Thanks Blaine. I'll try my best and if I have to, I'll contact you through portalparts.com (which is a very nice site, btw).
 Quote

All times are EST. The time is now 02:44 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content