Meerdere twitteraccounts gebruiken.

Gestart doorJvdw12 reacties41 weergaven

13 berichten · pagina 1 van 1

Jvdw

Lid · Topicstarter

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoi, in het onderstaande script kan ik de gewenste hoeveelheid tweets instellen in dit geval 5. Hoe kan ik dan doen dat hij de recentste tweets van bv3 accounts toont? Help me aub.

[COLOR= #0000BB]<?php[/COLOR]

[COLOR= #FF8000]//////////////////////////////////////////////
//Â Â Â Â Â Â Â Â TWITTER WIDGET VERSION 1.2.1Â Â Â Â Â Â Â Â //
//        Justin Streuper | streuper.com        //
//////////////////////////////////////////////[/COLOR]

[COLOR= #0000BB]$username[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// gebruikersnaam[/COLOR]
[COLOR= #0000BB]$tweetCount[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]5[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// aantal tweets[/COLOR]
[COLOR= #0000BB]$twitterFeed[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]http://api.twitter.com/1/statuses/user_timeline/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$username[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000].xml?count=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tweetCount[/COLOR][COLOR= #007700];

function[/COLOR] timeAgo[COLOR= #007700]([/COLOR][COLOR= #0000BB]$timestamp[/COLOR][COLOR= #007700])
{[/COLOR]
[COLOR= #0000BB]$timestamp[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/strtotime"]strtotime[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timestamp[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$now[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/time"]time[/URL][COLOR= #007700]();[/COLOR]
[COLOR= #0000BB]$timediff[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$now[/COLOR] [COLOR= #007700]-[/COLOR] [COLOR= #0000BB]$timestamp[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/switch"]switch[/URL][COLOR= #007700]([/COLOR]true[COLOR= #007700])
{
case ([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]60[/COLOR][COLOR= #007700]):[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$timediff[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] seconds ago[/COLOR][COLOR= #007700];

case([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]60[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]3600[/COLOR][COLOR= #007700]):[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timediff[/COLOR]/[COLOR= #0000BB]60[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000] minutes ago[/COLOR][COLOR= #007700];

case([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]3600[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]7200[/COLOR][COLOR= #007700]):[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timediff[/COLOR]/[COLOR= #0000BB]3600[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000] hour ago[/COLOR][COLOR= #007700];

case([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]7200[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]86400[/COLOR][COLOR= #007700]):[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timediff[/COLOR]/[COLOR= #0000BB]3600[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000] hours ago[/COLOR][COLOR= #007700];

case([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]86400[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]172800[/COLOR][COLOR= #007700]):[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timediff[/COLOR]/[COLOR= #0000BB]86400[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000] day ago[/COLOR][COLOR= #007700];

case([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]172800[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]602800[/COLOR][COLOR= #007700]):[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timediff[/COLOR]/[COLOR= #0000BB]86400[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000] days ago[/COLOR][COLOR= #007700];

case([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]602800[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]1209600[/COLOR][COLOR= #007700]):[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timediff[/COLOR]/[COLOR= #0000BB]602800[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000] week ago[/COLOR][COLOR= #007700];

case([/COLOR][COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]1209600[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$timediff[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]3026000[/COLOR][COLOR= #007700]):[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/floor"]floor[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$timediff[/COLOR]/[COLOR= #0000BB]602800[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000] weeks ago[/COLOR][COLOR= #007700];

default:[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]d-m-Y H:i[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$timestamp[/COLOR][COLOR= #007700]);
}
}



function[/COLOR] makeLinksClickable[COLOR= #007700]([/COLOR][COLOR= #0000BB]$text[/COLOR][COLOR= #007700])
{[/COLOR]
[COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"#(^|[
 ])([w]+?://[w]+[^ "
	< ]*)#"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"\1<a href="\2" target="_blank">\2</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"#(^|[
 ])((www|ftp).[^ "	
< ]*)#"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"\1<a href="http://\2" target="_blank">\2</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"/@(w+)/"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"<a href="http://www.twitter.com/\1" target="_blank">@\1</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$text[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"/#(w+)/"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"<a href="http://search.twitter.com/search?q=\1" target="_blank">#\1</a>"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$text[/COLOR][COLOR= #007700];
}[/COLOR]

[COLOR= #0000BB]$twitterCurl[/COLOR] [COLOR= #007700]=[/COLOR] curl_init[COLOR= #007700]();[/COLOR]
curl_setopt[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitterCurl[/COLOR][COLOR= #007700],[/COLOR] CURLOPT_URL[COLOR= #007700],[/COLOR] [COLOR= #0000BB]$twitterFeed[/COLOR][COLOR= #007700]);[/COLOR]
curl_setopt[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitterCurl[/COLOR][COLOR= #007700],[/COLOR] CURLOPT_RETURNTRANSFER[COLOR= #007700],[/COLOR] TRUE[COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$twitter[/COLOR] [COLOR= #007700]=[/COLOR]curl_exec[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitterCurl[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$tweets[/COLOR] [COLOR= #007700]=new[/COLOR] SimpleXMLElement[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitter[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/foreach"]foreach[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$tweets[/COLOR][COLOR= #007700]->[/COLOR]status [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<div class="tweet-container">[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<div class="tweet-user-image">[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<img src="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700]->[/COLOR]user[COLOR= #007700]->[/COLOR]profile_image_url[COLOR= #007700].[/COLOR][COLOR= #DD0000]" alt="" />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]</div>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<div class="tweet-username">[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<a href="http://www.twitter.com/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700]->[/COLOR]user[COLOR= #007700]->[/COLOR]screen_name[COLOR= #007700].[/COLOR][COLOR= #DD0000]">[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700]->[/COLOR]user[COLOR= #007700]->[/COLOR]name[COLOR= #007700].[/COLOR][COLOR= #DD0000]</a>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]</div>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<div class="tweet-message">[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL]makeLinksClickable[COLOR= #007700]([/COLOR][COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700]->[/COLOR]text[COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]</div>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<div class="tweet-post-datetime">[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL]timeAgo[COLOR= #007700]([/COLOR][COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700]->[/COLOR]created_at[COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]</div>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]</div>[/COLOR][COLOR= #007700];

}[/COLOR]

curl_close[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitterCurl[/COLOR][COLOR= #007700]);[/COLOR]
?>


Alvast bedankt hoor smile
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
het hele geheel in een foreach wrappen, als je meerdere accounts wilt tonen.
De account plaats je dan in een array. De key voor de username, de value voor het aantal tweets.

(vergeet de functies niet!!)

[COLOR= #0000BB]<?php
$accounts[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
[COLOR= #0000BB]$accounts[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pietje[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$accounts[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]klaasje[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]9[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$accounts[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]jantje[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]4[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$accounts[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$account[/COLOR][COLOR= #007700]=>[/COLOR][COLOR= #0000BB]$count[/COLOR][COLOR= #007700]) {[/COLOR]

  [COLOR= #0000BB]$twitterFeed[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]http://api.twitter.com/1/statuses/user_timeline/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$account[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000].xml?count=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$count[/COLOR][COLOR= #007700];[/COLOR]
  [COLOR= #0000BB]$twitterCurl[/COLOR] [COLOR= #007700]=[/COLOR]     curl_init[COLOR= #007700]();[/COLOR]
  curl_setopt[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitterCurl[/COLOR][COLOR= #007700],[/COLOR] CURLOPT_URL[COLOR= #007700],[/COLOR] [COLOR= #0000BB]$twitterFeed[/COLOR][COLOR= #007700]);[/COLOR]
  curl_setopt[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitterCurl[/COLOR][COLOR= #007700],[/COLOR] CURLOPT_RETURNTRANSFER[COLOR= #007700],[/COLOR] TRUE[COLOR= #007700]);[/COLOR]
  [COLOR= #0000BB]$twitter[/COLOR]     [COLOR= #007700]=[/COLOR]    curl_exec[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitterCurl[/COLOR][COLOR= #007700]);[/COLOR]
  [COLOR= #0000BB]$tweets[/COLOR]     [COLOR= #007700]=    new[/COLOR] SimpleXMLElement[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitter[/COLOR][COLOR= #007700]);[/COLOR]
    
    [URL="http://www.php.net/foreach"]foreach[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$tweets[/COLOR][COLOR= #007700]->[/COLOR]status [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700])
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]    [COLOR= #DD0000]<div class="tweet-container">[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]<div class="tweet-user-image">[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]            [COLOR= #DD0000]<img src="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700]->[/COLOR]user[COLOR= #007700]->[/COLOR]profile_image_url[COLOR= #007700].[/COLOR][COLOR= #DD0000]" alt="" />[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]</div>[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]<div class="tweet-username">[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]            [COLOR= #DD0000]<a href="http://www.twitter.com/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700]->[/COLOR]user[COLOR= #007700]->[/COLOR]screen_name[COLOR= #007700].[/COLOR][COLOR= #DD0000]">[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700]->[/COLOR]user[COLOR= #007700]->[/COLOR]name[COLOR= #007700].[/COLOR][COLOR= #DD0000]</a>[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]</div>[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]<div class="tweet-message">[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]            makeLinksClickable[COLOR= #007700]([/COLOR][COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700]->[/COLOR]text[COLOR= #007700]);[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]</div>[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]<div class="tweet-post-datetime">[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]            timeAgo[COLOR= #007700]([/COLOR][COLOR= #0000BB]$tweet[/COLOR][COLOR= #007700]->[/COLOR]created_at[COLOR= #007700]);[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]            [COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]        [COLOR= #DD0000]</div>[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL]    [COLOR= #DD0000]</div>[/COLOR][COLOR= #007700];
            
        }[/COLOR]
    
    curl_close[COLOR= #007700]([/COLOR][COLOR= #0000BB]$twitterCurl[/COLOR][COLOR= #007700]);
}[/COLOR]
?>
0
Jvdw

Lid · Topicstarter

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik zou eig graag hebben dat ik gewoon 5tweets toon, maar van verschillende personen:
Bv:
Aarclay: @iets hohohoo
5sec geleden
One2xs: marjolein verlaat ons :c
2dagen geleden
Jvdw: blulublublub
3dagen geleden

Enzoverder snapje?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Dan moet je alles in een aparte array zetten, en die weer uitlezen.
0
Jvdw

Lid · Topicstarter

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoebloos
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Zulke dingen zoek ik ook altijd uit, i.p.v. te vragen hoe :? ... wink
Maar het komt er op neer dat je alle data in een array moet verwerken.
In je foreach waarmee je per user de tweets ophaalt maak je een array aan:
$tweets[] = $tweets->status i.p.v. alla tweets te tonen.

Buiten je foreach kan je dan $tweets uitlezen (met print_r om deze eens te programmeertechnisch te bekijken) en dan kan je erop sorteren, limiteren (array_slice) etc....

Kan en klaar voorbeeld kan ik ook geven, maar daar leer je niks van. Dus probeer het eerst eens met mijn uitleg.
0
Jvdw

Lid · Topicstarter

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dus ik moet alles ophalen en dan sorteren op datum redface
toevoeging op 25 juni 2012, 23:33:59:
Ik snap het eig nie, ken niet veel van php sadley
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Lees mijn vorige post eens. Heb nog niks gezien wat je eruit geprobeerd hebt?
Plaats alles eerst maar in een array. wink...
0
Jvdw

Lid · Topicstarter

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ooh ik snap het maar hoe ik het moet doen sadley
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Met je muis, je hand en je toetsenbord en gebruik van een goede editor en logisch kijken.
Ik heb al uitleg gegeven..... wink. Probeer nou maar...
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jvdw schreef:
ooh ik snap het maar hoe ik het moet doen sadley
Als je maximum 5 tweets wilt tonen van die 3 accounts, dan haal je de laatste 5 tweets van die 3 accounts op en stop je die in dezelfde array met de tijd. Dan haal je ze uit array, gesorteerd op tijd met een maximum van 5.

toevoeging op 26 juni 2012, 11:50:46:
Aarclay schreef:
Met je muis, je hand en je toetsenbord en gebruik van een goede editor en logisch kijken.
Ik heb al uitleg gegeven..... wink. Probeer nou maar...
schaterworshippy
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Echt, als ik uitleg geef, en ze vragen dan nog hoe je het moet doen, dan rest me dit nog als vervolgantwoord. Hoe lullig of grappig het ook kan klinken.

Het lijkt me toch niet meer dan logisch om zelf eens wat te proberen, ongeacht je niet 100% weet of het goed is? Dat kan je immers altijd zelf uittesten of verder vragen op het forum.....

Nadeel is wel dat je met een multi-dimensionale array te maken zal hebben, wat iets complexer is dan een enkele array, maar oefening baart kunst. Vroeger was ik daar ook geen vriendjes mer, maar nu bestaat mijn nieuwe CMS voor een groot deel uit deze arrays wink.
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik zal het wat verduidelijken.

Eerst haal je ze van alle drie op, die steek je in een array, zo:

$tweetsPers1 = array met tweets
idem voor 2
idem voor 3
$tweets = new Array($tweetsPers1,$tweetsPers2,$tweetsPers3);
foreach($k in $tweets) (zoek maar op hoe foreach werkt)
if($tweets[$k] is de nieuwste and counter is niet groter dan 5)
{
Zet in een nieuwe array met je echte tweets, bv $tweetsDisplay
Verhoog counter
}
geef tweetsDisplay weer.

Das ongeveer je structuur.
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren