Jump to content


$etomite->getDocument and showinmenu


  • You cannot reply to this topic
7 replies to this topic

#1 vlieg

    Etomite Forum Newbie

  • Member
  • 8 posts

Posted 01 April 2008 - 08:59 AM

when I use $etomite->getDocument in a snippet it usually works. But I found out that when I uncheck showinmenu in a document (showinmenu is thus false or 0) this function no longer works.

I tried the following lines in snippets:

$doc = $etomite->getDocument($id, $fields="*");
$title = $doc['pagetitle'];
echo "title is ".$title;


Without showinmenu checked I am not seeing: "title is [pagetitle]".

Is this a bug or is this supposed to happen ?

I tried using getPageInfo instead but I need the longtitle and for some reason longtitle isnt supported in this function.

Edited by vlieg, 01 April 2008 - 09:01 AM.


#2 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 01 April 2008 - 09:23 AM

I can confirm that getDocument() does not return data if the showinmenu is unchecked.

getPageInfo(), does however return the data AND supports longtitle.

$id=$etomite->documentIdentifier;
$doc=$etomite->getPageInfo($id, $active=1, $fields='id, pagetitle, description, longtitle, alias');
print_r($doc);
$title=$doc['longtitle'];
return "Title: ". $title;
[edit: typo]

Edited by Cris D., 01 April 2008 - 09:23 AM.


#3 Dean

    Loves Etomite Forums!

  • Admin
  • 4,758 posts
  • Gender:Male

Posted 01 April 2008 - 11:13 AM

One for the bug tracker?

#4 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 01 April 2008 - 01:26 PM

Nope... Intended functionality of several API functions is to monitor showinmenu just like they monitor published and deleted...

#5 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 01 April 2008 - 02:10 PM

Please reconsider!

There is good reason that a function called getDocument might not return delete or unpublished documents.
I don't see a good reason why a document should not be explicitly 'got' just because it isn't being shown in menus.

edit:
or add an additional optional parameter to say whether or not to ignore the 'show in menu' value, if the change would mean too many existing menu snippets would not honour the new flag.

Edited by mikef, 01 April 2008 - 07:37 PM.


#6 vlieg

    Etomite Forum Newbie

  • Member
  • 8 posts

Posted 01 April 2008 - 10:08 PM

Thanks for the quick replies.

I agree strongly with mikef. Showinmenu is something completely different. Why handle it the same way as unpublished or deleted? The document is still being shown in the browser so why not get the information from it through getDocument??

For me it was a complete suprise to see it not working (I use a sql query now to get what i want as i could not get getPageInfo working with longtitle, but that could be an error on my part)

Edited by vlieg, 01 April 2008 - 10:10 PM.


#7 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 01 April 2008 - 10:16 PM

  function getActiveChildren($id=0, $sort='menuindex', $dir='', $fields='id, pagetitle, longtitle, description, parent, alias, showinmenu', $limit="", $showhidden=false) {
   // returns a two dimensional array of $key=>$value data for active documents only
   // $id = id of the document whose children have been requested
   // $sort = the field to sort the result by
   // $dir = sort direction (ASC|DESC)
   // $fields = comma delimited list of fields to be returned for each record
   // $limit = maximun number of records to return (default=all)
   // $showhidden = setting to [true|1] will override the showinmenu flag setting (default=false)

Sending all parameters, including $showhidden = true; will bypass the default setting... The getAllChildren(), getActiveChildren(), and getDocuments() API functions are the only three that use this method and all are set to false by default... Oh, yeah, and bacause getDocument() actually calls getDocuments(), it uses it too... I agree that it shouldn't and will evaluate which functions will or won't make use of it before the v1.0 release...

#8 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 14 April 2008 - 02:28 PM

I have modified the getDocument() function in the Prelude v1.0 code base so that it ignores the showinmenu flag, but getDocuments() still defaults to $showhidden=false...





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users