Thanks to oddz and some google searches regarding my ongoing Drupal7 dev…
I have created a new block inside a new module eventlist.module which seems to work without any problems.
I just can’t figure out how I display the results to the page from my EFQ.
The first thing I would recommend is using a module name that is less likely to conflict with another module. The module name event seems likely to already exist in contrib. Even though you aren’t using that module it is always best to use unique module names. The second is that all functions in a module should typically begin with the module name to prevent conflicts in function names across modules.
With that said I have provided code for a module named eventapp that exposes the event list block.
I was hoping you’d come back oddz
Can’t thank you enough right now been at this for hours
Ok, I understand the naming convention issues - I’ll make a note for future reference.
I didn’t change eventlist to eventapp it was slightly confusing me and everything seems to work by just using eventlist.
So what I can gather, we just needed to change the html with the function name so the block called the function, is that right?
It was also giving an error at first because we had
foreach($node as $node)
instead of
foreach($nodes as $node)
After this little change I got a list of three titles in a list
Its not the final fix though this is a big stepping stone for me right now using EFQs been reading all about them and trying to learn more PHP, still trying to understand some of the code above (:
Couple of questions
Is this how I’d setup all my future EFQs in place of a view?
What if I didn’t have a block, how else would I show the EFQ result?
What if I have 20 different EFQs, would I need to create 20 different modules?
And finally, in your eyes, this is far much better than creating a view?