Jump to content

Welcome! You're currently a Guest.

If you'd like to join in the Discussion, or access additional features in our forums, please sign in with your Evernote Account here. Have an Evernote Account but forgot your password? Reset it! Don't have an account yet? Create One! You'll need to set your Display Name before your first post.

Photo

To get note's tag, but no returns. pls reply me.


  • Please log in to reply
4 replies to this topic

#1 Lil Dre

Lil Dre

  • PipPip
  • Title: Alliance Lackey
  • Group: Members
  • 71 posts

Posted 28 July 2012 - 04:08 PM

I want to get the note's title and tag, but it only returns with titles, no tags.

what's wrong with my code?

shouldn't I use the "getTag" to read out the note's tag?

it's my code:
<?php
$listnote = $noteStore->listNotebooks($_SESSION['accessToken']);
$notebookone = $listnote;
$notebookguid = $notebookone->guid;

$filter = new NoteFilter();
$filter->notebookGuid = $notebookguid;
$result = $noteStore->findNotes($_SESSION['accessToken'], $filter, 0, 10);

$remain = ($result->totalNotes)-($result->startIndex);

$filte = new NoteFilter();
$filte->notebookGuid = $notebookguid;
$totalnotes = $noteStore->findNotes($_SESSION['accessToken'], $filte, 0, $remain);

foreach($totalnotes->notes as $notes){
$fullNote = $noteStore->getNote($_SESSION['accessToken'], $notes->guid, true, false, false, false);
$fullTag = $noteStore->getTag($_SESSION['accessToken'], $notes->guid);
echo $fullNote->title . "<br>";
echo $fullTag->name . "<br>";;
}
}
?>

#2 Julien Boedec

Julien Boedec

  • Title: Browncoat
  • Group: Evernote Employee
  • 407 posts

Posted 28 July 2012 - 09:40 PM

Have you tried reading the property Note.tagNames? That should give you the list of tags and you won't have to call our service again.

#3 Lil Dre

Lil Dre

  • PipPip
  • Title: Alliance Lackey
  • Group: Members
  • 71 posts

Posted 29 July 2012 - 12:46 AM

okay, I have tried to call tagNames. I got titles, but still no tags.

foreach($totalnotes->notes as $notes){
$fullNote = $noteStore->getNote($_SESSION['accessToken'], $notes->guid, true, false, false, false);
echo $fullNote->title . "<br>";
echo $fullNote->tagNames . "<br>";;
}

#4 berryboy

berryboy

  • Pip
  • Title: Member
  • Group: Members
  • 42 posts

Posted 29 July 2012 - 02:48 PM

Note.tagGuids is an array. Ref. http://dev.evernote....tml#Struct_Note

$fullNote = $noteStore->getNote($_SESSION['accessToken'], $notes->guid, true, false, false, false);
$fullTag = $noteStore->getTag($_SESSION['accessToken'], $notes->guid);


To


$fullNote = $noteStore->getNote($_SESSION['accessToken'], $notes->guid, true, false, false, false);

foreach( $fullNote.tagsGuids as $tagGuid ){

 $fullTag = $noteStore->getTag($_SESSION['accessToken'], $tagGuid);
 echo $fullTag->title . "<br>";
 echo $fullTag->name . "<br>";
}


#5 Lil Dre

Lil Dre

  • PipPip
  • Title: Alliance Lackey
  • Group: Members
  • 71 posts

Posted 30 July 2012 - 02:22 AM

Why can't I use tagNames?

if I want to, how should I do?

Actually, my purpose is conditional selection.

I want to select the note which fit the date and tag.

so, I tried to change my code to:

foreach($totalnotes->notes as $notes){
  $fullNote = $noteStore->getNote($_SESSION['accessToken'], $notes->guid, true, false, false, false);
  $date = date('Y-m-d',$fullNote->created/1000);
  if($date == $_SESSION['t_date'] && $date == $_SESSION['t_date2']){
    foreach($fullNote->tagGuids as $tagGuid){
	  $fullTag = $noteStore->getTag($_SESSION['accessToken'], $tagGuid);
	  if($fullTag->name == $_SESSION['t_tag']){
		 echo $fullNote->title . "<br>";
	  }
    }
  }
}

but not working all the time.

Of course $_SESSION['t_date'], $_SESSION['t_date'] and $_SESSION['t_tag'] have values




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Clip to Evernote