The variable name $xml was changed to $statuses further up and you didn't
change the later $xml to $statuses.

Abraham
-------------
Abraham Williams | Hacker Advocate | abrah.am
 <http://abrah.am>Just launched from Answerly <http://answerly.com>:
InboxQ<http://inboxq.com>for Chrome
@abraham <https://twitter.com/abraham> | github.com/abraham | blog.abrah.am
This email is: [ ] shareable [x] ask first [ ] private.



On Sun, Mar 27, 2011 at 15:15, Jon <j...@whotweet.net> wrote:

> Thanks Blaze... I think we're getting closer, now the error is on like
> 78 (You can see it here: http://realestateagentswhotweet.com/kristan-cole/
> )
>
> Here is the code:
>
> <?php get_header(); ?>
>        <div id="content" class="hfeed">
>                <?php
>                if(function_exists('bcn_display'))
>                {
>                        echo '<ul class="breadcrumbs"><li>';
>                        bcn_display();
>                        echo '</li></ul>';
>                }
>                ?>
>                <?php dynamic_sidebar('page_top'); ?>
>                <?php if (have_posts()) : ?>
>                <!-- heading -->
>                <div class="heading-box">
>                        <div class="heading">
>                                <h1>AGENT PROFILE</h1>
>                        </div>
>                </div>
>                <?php while (have_posts()) : the_post();
>                //init custom fields
>                $pid = get_the_ID();
>                $field_about    = get_post_meta($pid, field_about, true);
>                ?>
>                        <div class="text-section">
>                                <p>The profile of <?php the_category(', ');
> ?> real estate agent <?
> php the_title(); ?>.</p>
>                        </div>
>                        <div class="profile-box">
>                                <div class="text-holder vcard">
>                                        <div class="name-holder">
>                                                <strong class="name"><span
> class="fn"><?php the_title(); ?> </
> span></strong> <em class="job"><a href="http://www.twitter.com/<?php
> echo get_the_content(); ?>" target="_blank"><?php echo
> get_the_content(); ?></a></em>
>                                        </div>
>                                        <?php if($field_about): ?>
>                                        <p class="entry-content"><?php echo
> $field_about; ?></p>
>                                        <?php endif; ?>
>                                        <?php the_tags('<div
> class="tags"><span>Areas Served:</
> span><ul><li>', ',</li><li>', '</li></ul></div>'); ?>
>                                </div>
>                        </div>
>                <?php endwhile; ?>
>                <!-- heading -->
>                <div class="heading-box">
>                        <div class="heading">
>                                <h2>AGENT TWEETS</h2>
>                        </div>
>                </div>
>                <div class="text-section">
>                        <p>The latest tweets from <?php the_title(); ?>.
> </p>
>                </div>
>      <?php
>
>     require_once("twitteroauth/twitteroauth.php");
>     require_once("config.php");
>     $twitterUser = get_the_content();
>
>     $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
> OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
>     $statuses = $connection->get("statuses/user_timeline",
> array("screen_name" => $twitterUser));
>
>     function twitterTime($time) {
>           $delta = time() - $time;
>           if ($delta < 60) {
>              return "less than a minute ago.";
>           } else if ($delta < 120) {
>             return "about a minute ago.";
>           } else if ($delta < (45 * 60)) {
>             return floor($delta / 60) . " minutes ago.";
>           } else if ($delta < (90 * 60)) {
>             return "about an hour ago.";
>           } else if ($delta < (24 * 60 * 60)) {
>             return "about " . floor($delta / 3600) . " hours ago.";
>           } else if ($delta < (48 * 60 * 60)) {
>             return "1 day ago.";
>           } else {
>              return floor($delta / 86400) . " days ago.";
>            }
>     }
>
>     $twitterString = "";
>
>                      foreach ($xml->status as $entry)
>                      {
>
>
>                   $status               = $entry->text;
>                  $profilePic   = $entry->user->profile_image_url;
>                  $profileName  = $entry->user->screen_name;
>                  $statusRealName       = $entry->user->name;
>                  $profileURL   = $entry->user->url;
>                  $statusDate   = $entry->created_at;
>                  $statusSource         = $entry->source;
>                  $statusDateFormatted =
> twitterTime(strtotime($statusDate));
>                  $profileBio   = $entry->user->description;
>                  $statusFollowCount    = $entry->user->followers_count;
>
>                  echo "<div class=\"post hentry\">\n";
>                  echo "<div class=\"image-box\">\n";
>                  echo "<img class=\"photo\">\n";
>                  echo "<a href=\"http://www.twitter.com/$profileName\";
> target=
> \"_blank\"><img class=\"userPicThumb\" src=\"$profilePic\" alt=
> \"$profileRealName\" /></a>\n";
>                  echo "</div>\n";
>                  echo "<div class=\"text-box\">\n";
>                  echo "<div class=\"meta\">\n";
>                  echo "<strong class=\"post-link\">\n";
>                  echo "<a class=\"entry-title\" href=\"
> http://www.twitter.com/
> $profileName\" target=\"_blank\">$profileName</a>\n";
>                  echo "</strong>\n";
>                  echo "<span class=\"vcard\"><span class=\"fn\">
> $statusRealName</
> span></span>\n";
>                  echo "</div>\n";
>                  echo "<p class=\"entry-content\">$status</p>\n";
>                  echo "<div class=\"time\">\n";
>                  echo "<span>$statusDateFormatted from
> $statusSource</span>\n";
>                  echo "</div>\n";
>                  echo "</div>\n";
>                  echo "<div class=\"clear\"></div>\n";
>                  echo "</span>\n";
>                  echo "</div>\n";
>
>
>                      }
>                 ?>
>
>
> It says the error is on line 78, which is:
>
> foreach ($xml->status as $entry)
>
> The error is:
>
> Warning: Invalid argument supplied for foreach() in ... on line 78
>
> Thanks,
>
> Jon
>
>
>
> On Mar 27, 1:44 pm, Blaaze <blaazet...@gmail.com> wrote:
> > in this code above especially in your function twitterTime
> >
> > please remove single quotes and replace them with double quotes and
> > also remove that first line of comment, then try it will work
>
> --
> Twitter developer documentation and resources: http://dev.twitter.com/doc
> API updates via Twitter: http://twitter.com/twitterapi
> Issues/Enhancements Tracker:
> http://code.google.com/p/twitter-api/issues/list
> Change your membership to this group:
> http://groups.google.com/group/twitter-development-talk
>

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to