i trying develop ios
app wordpress blog , several reasons decided use phonegap
instead of objective-c. read tutorial posted here: http://alexbachuk.com/wordpress-and-phonegap-part-1/ , played around code of app : https://github.com/abachuk/wordpress-jquery-mobile-and-phonegap-app-for-ios
so far had set json
api , application user interface result of 2 days of research, found nothing useful issue. code generate json
api single post:
echo '"item": {'; $title = get_the_title(); echo '"title": "'.$title.'",' ; $text = get_the_content(); echo '"content": "'.$text.'",' ; echo '"post-foot": " post ",' ; echo '"post-num": "'.$post_num.'",' ; echo '}';
and want output them in ios app in such format:
<article class="post"> <section class="post-title"> <h2>{the post title}</h2> </section> <section class="post-text"> {the post content} </section> <section class="post-foot"> {the post foot} , {the post num} </section> </article>
i'm not experienced javascript
, prefer avoid libraries , jquery
this. suggestions how can this?
i found peace of code in app mentioned before , impressed me:
<ul data-role="listview" data-inset="true" id="all-posts"> {{#each posts}} <li><a data-transition="slide" href="single.html?{{@index}}">{{title}}</a></li> {{/each}} </ul>
well, if want use phonegap, don't want use libraries , frameworks, pretty have hand.
you use can use json.parse javascript object, use dom manipulation (document.createelement, element.appendchild etc.) create structure.
but... why in world not want use library? first thing 1 do, looking library, avoid reinventing wheel.
same thing in server end: not create json hand, use json_encode (if using php).
by way, code impressed handlebars, templating framework...
Comments
Post a Comment