symfony - How can I print Google Books api description? -
hie trying synopsis , other items author , published date printed. able achieve search terms, error occurs other words or terms
key "description" array keys "title, subtitle, authors, publisheddate, industryidentifiers, readingmodes, pagecount, printtype, categories, maturityrating, allowanonlogging, contentversion, imagelinks, language, previewlink, infolink, canonicalvolumelink" not exist.
i using symfony , twig. twig file looks :
{% item in items %} <article> <img src="{{ item.volumeinfo.imagelinks.thumbnail}}"/> <h4>{{ item.volumeinfo.title}}</h4> {{ item.volumeinfo.description }} <strong> {{ item.volumeinfo.publisheddate }}</strong><br/> <b>{{ item.volumeinfo.authors | join }}</b> </article>
what doing wrong? why work ? how can make work correctly time?
class googlebookscontroller extends controller { public function getvolumeaction($title) { $client =new client(); $response = $client- >get("https://www.googleapis.com/books/v1/volumes?q=$title"); $data=$response->json(); $items=$data['items']; return $this->render('bookreviewbundle:googlebooks:volume.html.twig', array('items'=>$items // ... )); }
thanks
i belive description field not mandatory, can follow
{% if item.volumeinfo.description defined %} {{ item.volumeinfo.description }} {% endif %}
Comments
Post a Comment