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>";;
}
}
?>
To get note's tag, but no returns. pls reply me.
Started by Lil Dre, Jul 28 2012 04:08 PM
4 replies to this topic
#1
Posted 28 July 2012 - 04:08 PM
#2
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
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>";;
}
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
Posted 29 July 2012 - 02:48 PM
Note.tagGuids is an array. Ref. http://dev.evernote....tml#Struct_Note
To
$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
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:
but not working all the time.
Of course $_SESSION['t_date'], $_SESSION['t_date'] and $_SESSION['t_tag'] have values
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













