Page 1 of 2 12 LastLast
Results 1 to 15 of 18

Thread: AWS Author?

  1. #1
    Registered Member incka's Avatar
    Join Date
    Aug 2003
    Location
    Wakefield, UK, EU
    Posts
    3,801

    AWS Author?

    What is the thing for Author, I can't get any Authors to display using:

    <b>Written by:</b> <? echo $items[0]['Author']; ?>

  2. #2
    Registered GCT13's Avatar
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    480
    If you're using something similar to my tutorial, you would set the variable as an array (because there could be more than I author)-
    PHP Code:
    elseif($d_ar[$j]['tag'] == 'Author')
      {
    $Author[] = $d_ar[$j]['value'];} 
    And then display the authors as such-
    PHP Code:
    foreach($Author as $auth){
        echo 
    $auth' ';

    ....

  3. #3
    Registered Member incka's Avatar
    Join Date
    Aug 2003
    Location
    Wakefield, UK, EU
    Posts
    3,801
    I have absolutly no idea how to implement what you just said.

    This is my code:

    PHP Code:
    <?php

    require_once('/home/nichetim/public_html/jewelrystore/jpcache/jpcache.php');

    // include class
    include("nusoap.php");

    // create a instance of the SOAP client object
    $soapclient = new
    soapclient("http://soap.amazon.com/schemas2/AmazonWebServices.wsdl",
    true);

    // uncomment the next line to see debug messages
    // $soapclient->debug_flag = 1;

    $var_array explode("/",$REQUEST_URI);

    $var $var_array[2];
    $asin $var;

    // create a proxy so that WSDL methods can be accessed directly
    $proxy $soapclient->getProxy();

    // set up an array containing input parameters to be
    // passed to the remote procedure
    $params = array(
                
    'asin'        => $asin,
                
    'tag'         => 'games2go-20',
                
    'type'        => 'heavy',
                
    'devtag'      => 'D2B58IDSY7XE6F'
    );

    // invoke the method 
    $result $proxy->ASINSearchRequest($params);
    $items $result['Details'];
    ?>
    <title>Book Reviews - <? echo $items[0]['ProductName']; ?></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    body {
        margin-left: 0px;
        margin-top: 0px;
        margin-right: 0px;
        margin-bottom: 0px;
    }
    .style1 {
        font-family: Tahoma;
        font-size: xx-small;
    }
    .style2 {
        font-family: Tahoma;
        font-size: xx-small;
        font-weight: bold;
        color: #947d36;
    }
    .style3 {font-size: xx-small; color: #947d36; font-family: Tahoma;}
    .style4 {color: #5a4916}
    .style5 {font-family: Tahoma; font-size: xx-small; color: #5a4916; }
    .style6 {
        color: #FF6600;
        font-weight: bold;
    }
    .menu {
        text-decoration: none; 
        color: #947d36; 
        font-family: "Verdana"; 
        font-size: xx-small;
        font-weight: bold;
        width: 160px;
        position: static;
        padding-left: 2px;
        display: block;
    }
    a.menu:hover {
        text-decoration: none; 
        color: #947d36; 
        font-family: "Verdana"; 
        font-size: xx-small;
        font-weight: bold;
        background-color: #BFB69D;
        width: 160px;
        position: static;
        padding-left: 2px;
    }
    -->
    </style>
    </head>
    <body bgcolor="#FFFFFF" link="#FF6600" vlink="#FF6600" alink="#FF6600">
    <form action="http://www.book-reviews.ws/search.php" method="get">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                      <td width="239"><table width="239"  border="0" cellspacing="0" cellpadding="0">
                          <tr> 
                            <td width="69"><img src="http://www.book-reviews.ws/images/index_13.gif" width="69" height="25"></td>
                            <td background="http://www.book-reviews.ws/images/index_14.gif"><div align="center"> 
                                <input type="text" size="20" name="q">
                              </div></td>
                            <td width="42"><input type="image" src="http://www.book-reviews.ws/images/index_15.gif" width="42" height="25" border="0"></td>
                          </tr>
                        </table></td>
                      <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                          <tr> 
                            <td background="http://www.book-reviews.ws/images/index_16.gif"><img src="http://www.book-reviews.ws/images/spacer.gif" width="1" height="16"></td>
                          </tr>
                          <tr> 
                            <td><table width="379" border="0" cellspacing="0" cellpadding="0">
                                <tr> 
                                  <td width="345" background="http://www.book-reviews.ws/images/spacer.gif" bgcolor="white"><img src="http://www.book-reviews.ws/images/spacer.gif" width="379" height="9"></td>
                                </tr>
                              </table></td>
                          </tr>
                        </table></td>
                      <td height="25" background="http://www.book-reviews.ws/images/bg_stretch.gif"><img src="http://www.book-reviews.ws/images/spacer.gif" width="95" height="25"></td>
                    </tr>
                  </table></td>
              </tr>
              <tr> 
                <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="187"><img src="http://www.book-reviews.ws/images/title_into.gif" width="187" height="23" alt="Book Reviews Categories" /></td>
                      <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr> 
                            <td bgcolor="white"></td>
                            <td width="39"></td>
                          </tr>
                        </table></td>
                      <td width="152" bgcolor="BFB69D"><img src="http://www.book-reviews.ws/images/title_bestseller.gif" width="90" height="17"></td>
                    </tr>
                  </table></td>
              </tr>
              <tr> 
                <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="171" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                          <tr> 
                            <td><img src="http://www.book-reviews.ws/images/side_curve.gif" width="171" height="10"></td>
                          </tr>
                          <tr> 
                            <td valign="top" background="http://www.book-reviews.ws/images/side_bg.gif"><table width="93%"  border="0" align="center" cellpadding="5" cellspacing="0">
                                <tr> 
                                  <td height="100%">

    <?php include("left.inc"); ?>

                                    <p class="style2"></p>
    <br /><br /><br /><br /><br /><br /><br /><br /><br />
    <br /><br /><br /><br /><br /><br /><br /><br /><br />
    <br /><br /><br /><br /><br /><br /><br /><br /><br />
    <br /><br /><br /><br /><br /><br /><br /><br /><br />
    <br /><br /><br /><br /><br /><br /><br /><br /><br />
    <br /><br /><br /><br /><br /><br /><br /><br /><br />
    <br /><br /><br /><br /><br /><br /><br /><br /><br />
    <br /><br /><br /><br /><br /><br /><br /><br /><br />
    <br /><br /><br /><br /><br /><br /><br /><br /><br />
    <br /><br /><br /><br /><br /><br /><br /><br /><br />
    <br /><br /><br /><br /><br /><br /><br /><br /><br />
    <br /><br /><br /><br /><br /><br /><br /><br /><br />

    </td>
                                </tr>
                              </table></td>
                          </tr>

                        </table></td>
                      <td valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                          <tr> 
                            <td></td>
                          </tr>
                          <tr> 
                            <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                <tr> 
                                  <td width="22" background="http://www.book-reviews.ws/images/content_side_bgleft.gif">&nbsp;</td>
                                  <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                      <tr> 
                                        <td><center><font class="style2 style4"><a href="http://www.book-reviews.ws" title="Book Reviews" style="text-decoration:none;" class="style2 style4"><h1>Book Reviews</h1></a></font></center><strong class="style2 style4"><font size="2" face="Georgia, Times New Roman, Times, serif"><? echo
    $items[0]['ProductName']; ?> </font></strong></td>
                                      </tr>
                                      <tr> 
                                        <td height="16"><div align="left"><img src="http://www.book-reviews.ws/images/separator.gif" width="398" height="12"></div></td>
                                      </tr>
                                      <tr> 
                                        <td class="style5"><font size="1">
    </form>



    <table>
    <tr>
    <td width="160"><div align="center">
    <img border=0 bordercolor=#336699 src="
    <? echo
    $items[0]['ImageUrlMedium']; ?>
    "></div></td>
    <td>
    <table width=65% border=0 cellspacing=0 cellpadding=0>
    <tr>
    <td width=60%>
    <b>Book:</b> <? echo
    $items[0]['ProductName']; ?><br>
    <b>Written by:</b> <? echo
    $items[0]['Author']; ?>

    </td>
    </tr><tr>
    <td width="60%">
    <b>Publisher:</b> <? echo $items[0]['Manufacturer']; ?><br>
    <? if (count($items[0]['Reviews']['AvgCustomerRating']) != 0) { ?>
    <b>Average Customer Rating:</b> <? echo $items[0]['Reviews']['AvgCustomerRating']; ?> / 5
    <? }
    else {
    echo 
    "<b>Average Rating:</b> No Rating Available";
    ?>
    <br>
    <form method="POST" action="http://www.amazon.com/exec/obidos/dt/assoc/handle-buy-box=<? echo $asin?>">
    <input type="hidden" name="asin.<? echo $asin?>" value="1">
    <input type="hidden" name="tag-value" value="games2go-20"> 
    <input type="hidden" name="tag_value" value="games2go-20">
    <input type="hidden" name="dev-tag-value" value="D6Y8R22P5D1FJ">
    <input type="submit" name="submit.add-to-cart" value="Buy From Amazon.com">
    </form> 
    </tr>
    </table>
    </td>
    </tr>
    </table>
    <br>
    <table width=95% border=0 cellspacing=0 cellpadding=0>
    <tr><td class="productinfo" width="80%"> <?
    if (count($items[0]['Reviews']['CustomerReviews']) != 0) {
    foreach(
    $items[0]['Reviews']['CustomerReviews'] as $r)
        {

    ?>

        <b><? echo $r['Summary']; ?>
        <br>Rating: <i>
        <? echo $r['Rating']; ?> / 5
    <br></i></b>
        <? echo $r['Comment']; ?>
        <hr color=#336699 size=0 align="center"><br><br>
    <?
    }
    }
    else {
    echo 
    "No reviews currently available.";
    }
    ?>
    </td>
    </tr>
    </table>

    </font></td>

  4. #4
    Registered GCT13's Avatar
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    480
    Try this-
    PHP Code:
    if (count($items[0]['Authors']) != 0){
      foreach(
    $items[0]['Authors'] as $auth){
        echo 
    $auth['Author']. ' ';
      }

    Understand how I derived this? It helps to look at the XML to see how the tags are nested. What you have here is 1 or more <Author> tags nested within the <Authors> tag. It's similar to how you display the customer reviews.
    Last edited by GCT13; 04-04-2004 at 10:13 AM.
    ....

  5. #5
    Registered Member incka's Avatar
    Join Date
    Aug 2003
    Location
    Wakefield, UK, EU
    Posts
    3,801
    I'm not sure how to implement it, thats my problem...

  6. #6
    Registered Member incka's Avatar
    Join Date
    Aug 2003
    Location
    Wakefield, UK, EU
    Posts
    3,801
    I can't get it to work...

  7. #7
    Registered GCT13's Avatar
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    480
    I edited the code, found an error. Try it now.
    ....

  8. #8
    Registered Member incka's Avatar
    Join Date
    Aug 2003
    Location
    Wakefield, UK, EU
    Posts
    3,801
    I'm getting this:

    Written by:
    Warning: Invalid argument supplied for foreach() in /usr/home/nichetim/public_html/bookreviews/book-reviews on line 261

  9. #9
    Registered GCT13's Avatar
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    480
    Okay, found another error and edited the post. Please try again...
    ....

  10. #10
    Registered Member incka's Avatar
    Join Date
    Aug 2003
    Location
    Wakefield, UK, EU
    Posts
    3,801
    http://www.book-reviews.ws/book-reviews/0060977337

    Look, it's is displaying the initial now...

  11. #11
    Registered Member incka's Avatar
    Join Date
    Aug 2003
    Location
    Wakefield, UK, EU
    Posts
    3,801
    Just a time check

  12. #12
    Registered GCT13's Avatar
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    480
    Kinda strange how it's displaying only the very first character of the author. Hmmm. (It's tricky using this AWS technique without being able to test it myselft so please bear with me.) Try this-
    PHP Code:
    if (count($items[0]['Authors']['Author']) != 0){ 
      echo 
    '<strong>Written by:</strong> ';
      foreach(
    $items[0]['Authors']['Author'] as $auth){ 
        echo 
    $auth' '
      } 

    ....

  13. #13
    Registered Member incka's Avatar
    Join Date
    Aug 2003
    Location
    Wakefield, UK, EU
    Posts
    3,801
    Now it doesn't display anything

    Do I need to put something in the head part of the document?

  14. #14
    Registered GCT13's Avatar
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    480
    Try this-
    PHP Code:
    <?php
    echo 'Written by: ' .$items[0]['Authors']['Author']. '<br /><br />'
    ?>
    ....

  15. #15
    Registered Member incka's Avatar
    Join Date
    Aug 2003
    Location
    Wakefield, UK, EU
    Posts
    3,801
    Not working

    Do you have MSN? I can give you FTP account and a reward (.com or .info or hosting on my server) if you get it fixed...
    Last edited by incka; 04-06-2004 at 09:07 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •