WordPress Post : http://junn.net/archives/575
Github source :
- https://github.com/junn279/steemjs_example/blob/master/steem03_1.php (lite version)
- https://github.com/junn279/steemjs_example/blob/master/steem03.php
ย
Continue to our previous example, this time Iโll introduce get_discussions_โฆ functions.
I donโt know why, but functions are named like as below.
์ง๋ ํฌ์คํ ์ ์ด์ด, get_discussion ํจ์๋ฅผ ์ด์ฉํด 20๊ฐ ์ด์์ ์๋ฃ, ์ฐ์๋๋ ์๋ฃ ๋ฐ๊ธฐ๋ฅผ ํ์ธํด๋ณผ ์์ ์ด๋ค. ํจ์ ์ด๋ฆ์ ์ discussion์ด๋ผ๊ณ ํ๋์ง ์ ๋ชจ๋ฅด๊ฒ ๋ค.


At this time, make a source like this. A Little bit different from previous sources, but this is more effective to view sequential 10, 20 (next 10) posts. I used getDiscussionsByCreated. Literally, byCreated means โretrieve posts in the order when they were created.
Look atย โqueryโ and number of โlimitโ is 11 not 10. Last one is for โretrieve next 10 postsโ
๊ธฐ๋ณธ ํ์ ์๊ณผ ๊ฐ์ด ์ก๋๋ค. ์ผ๋จ ๋ถ๋ฌ์ค๋ ๊ฐฏ์๋ฅผ 11๋ก ํ ๊ฒ์, ๋ง์ง๋ง ๋ฐ์ดํฐ๋ ๋ค์ 10๊ฐ๋ฅผ ๋ถ๋ฌ์ด์ค๊ธฐ ์ํ ๋ฐ์ดํฐ๋ก ํ์ํ๊ธฐ ๋๋ฌธ์ด๋ค.

As member variation of โqueryโ object, set start_author and start_permlink from last 11th post(but array index starts from number zero, so number 10 indicate the 11th post).
And then if you watch the developer console, you can see the retrieved posts.
But in this case, you should not put โinner query2~steem.api.getDis.. functionโ out of first getDiscussionByโฆ function. Because steem.api is running synchronously.
Iโm sure there is another way to run these sequential functions asynchronously. But I donโt know yet.
๋ฐ์์จ ๋ฐ์ดํฐ์ ๋ง์ง๋ง(11๋ฒ์งธ; array์์ index๋ 10) ํฌ์คํธ์ ์๋ฃ๋ฅผ ์ด์ฉํด์ ๋ค์ ๋ด์ฉ์ ๋ถ๋ฌ์จ๋ค. ํจ์ ๋ด๋ถ์ ๋ค์ ํจ์๋ฅผ ๋ฃ์ด์ผํ๋ ์ด์ ๋ ๋๊ธฐํ๋ก ์งํ๋๋ ํจ์์ด๊ธฐ ๋๋ฌธ์ ๋ฐ์ผ๋ก ๋บ ๊ฒฝ์ฐ ์ ๋๋ก๋ ๋ณ์๊ฐ์ด ์ธํ ๋์ง ์๊ธฐ ๋๋ฌธ์ด๋ค.
ย
Finally, I made a source using this function, put a button and by using it, we can get next 10 posts.
๋ง์ง๋ง์ผ๋ก ๋ง๋ ์์ค๋ ๋ฒํผ์ ์ด์ฉํด์ ๊ณ์์ ์ผ๋ก ํฌ์คํธ๋ฅผ ์ฐ์ฅํ๋ ์์ค์ด๋ค.
https://github.com/junn279/steemjs_example/blob/master/steem03.php



There is a โclickโ button, and then you can get next 10 posts. These are match to what we can see through https://steemit.com/created/kr perfectly. (Be sure to be different from my result)
์๋์ ๊ฐ์ ๊ฒฐ๊ณผ๋ฅผ ๋ง๋ค์ด๋ด์๋ค.


ย
1 comment