Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION menu_data() documentation
#1
I'm revisiting GetSimple having been away many years, and having forgotten all about it.

As far as I can see the doumentation for the function menu_data() is "outputs an array of menu specific data".

Um, that's not very helpful - is there anything more specific anywhere?


Of course as in most such projects all the work goes into the code, and very little into the documentation - that's understandable. But I'm finding it lincreases the time I have to spend, and makes the task un-simple....

Thanks for any help, even a pointer to where the function is coded.
Reply
#2
(2020-05-01, 04:31:31)drking Wrote: I'm revisiting GetSimple having been away many years, and having forgotten all about it.

As far as I can see the doumentation for the function menu_data() is "outputs an array of menu specific data".

Um, that's not very helpful - is there anything more specific anywhere?


Of course as in most such projects all the work goes into the code, and very little into the documentation - that's understandable. But I'm finding it lincreases the time I have to spend, and makes the task un-simple....

Thanks for any help, even a pointer to where the function is coded.

I may be barking up the wrong tree here so bear with with me if I've misunderstood. 

I would imagine it's exactly as is says: 

The function returns an array of all the menu items (pages created that have been selected to be included in the menu).
Next, the values from that array are probably used within the list context to display the menu within the website.

Where are you looking at the reference for unction menu_data()?

thanks
Reply
#3
Thanks

I'm looking at:
Docs | User Guide | Themes | Complete Template Tags Reference

There is also a later section:
Developer Information | Core documentation | Template functions
but that page hasn't been written yet

It may produce a list of the pages "page-1", "page-2", "subpage-1a" in a randomly ordered linear array, or it may produce a list of page addresses and descriptions, or it may have a structiure to indicate parent-child relationships, or.... I could try it, but that is not the way to build reliable software, in case there is something I don't spot that bites me later.

Coming back to this after so long I'm really quite struck by how the documentation does not deliver clear information, right from the first page. I'd offer some concrete help, but I guess a newcomer's suggestions probably aren't welcome!
Reply
#4
Hi.

Maybe this is what you are looking for ?

http://get-simple.info/wiki/themes:template_tags
Reply
#5
Thank you, but that page is
Docs | User Guide | Themes | Complete Template Tags Reference

which is the one I referred to in my last message and the one I consulted in the first place to find the inadequate definition.

If you look at the the text describing that function it is in essence as I said.

The function returns some structured data, in an array. All I'd like to know is the definition of that data. I gave a number iof alternatives for data that could be returned by the function - but no-one seems able to go further than 'some data'.

I'd try to check it out from the code but it's a big task unless someone helps. Not simple.

Thanks for engaging Smile
Reply
#6
The function is coded in admin\inc\theme_functions.php

In essence it returns a single array if the menu data for a single page is requested:
$specific = array("slug"=>$slug,"url"=>$url,"parent_slug"=>$parent,"title"=>$title,"menu_priority"=>$pri,"menu_text"=>$text,"menu_status"=>$menuStatus,"private"=>$private,"pub_date"=>$pubDate);

or an array of arrays for all pages in menu_sorted order if not:
foreach ($pagesSorted as $page) {
.....
$menu_extract[] = $specific;
}
return $menu_extract;

If the xml flag is set true, the info comes back as xml.

Hope that helps someone else. It's really important to have good documentation for newcomers, particularly if you are aiming to appeal because of being simple
Reply




Users browsing this thread: 1 Guest(s)