Goedenavond allemaal,
Ik zit een beetje met een probleem. Ik ben bezig met een site waar mensen nieuws kunnen lezen dat ik ophaal van andere websites. Echter zit ik nu met een probleem waar ik niet helemaal uit kom.
Probleem:
Ik heb het aantal getoonde feeds gelimiteerd naar 6, maar nu wil ik op de plek van feed 3 een normaal plaatje (dus niet uit feed) weergeven, maar na dat plaatje moeten resultaat 4, 5 en 6 getoond worden.
Globaal gezien dus zo:
- Feed resultaat 1
- Feed resultaat 2
- Feed resultaat 3
- Plaatje
- Feed resultaat 4
- Feed resultaat 5
- Feed resultaat 6
Code die ik nu heb:
Daar moet dus op een of andere manier ingebouwd worden dat ie vanaf nummer 3 (of 4) start, dan kan ik tussen de feeds mooi een plaatje verwerken.
Ik hoop dat jullie me kunnen helpen met een passende oplossing!
Met vriendelijke groet,
Jos
Ik zit een beetje met een probleem. Ik ben bezig met een site waar mensen nieuws kunnen lezen dat ik ophaal van andere websites. Echter zit ik nu met een probleem waar ik niet helemaal uit kom.
Probleem:
Ik heb het aantal getoonde feeds gelimiteerd naar 6, maar nu wil ik op de plek van feed 3 een normaal plaatje (dus niet uit feed) weergeven, maar na dat plaatje moeten resultaat 4, 5 en 6 getoond worden.
Globaal gezien dus zo:
- Feed resultaat 1
- Feed resultaat 2
- Feed resultaat 3
- Plaatje
- Feed resultaat 4
- Feed resultaat 5
- Feed resultaat 6
Code die ik nu heb:
[COLOR= #0000BB]<?php
$url[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"http://www.***.com/***/"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$rss[/COLOR] [COLOR= #007700]=[/COLOR] simplexml_load_file[COLOR= #007700]([/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$rss[/COLOR][COLOR= #007700])[/COLOR]
[COLOR= #0000BB]$counter[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700];
{[/COLOR]
[COLOR= #0000BB]$items[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$rss[/COLOR][COLOR= #007700]->[/COLOR]channel[COLOR= #007700]->[/COLOR]item[COLOR= #007700];[/COLOR]
[URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$items[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$item[/COLOR][COLOR= #007700])[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700](++[/COLOR][COLOR= #0000BB]$counter[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]3[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/break"]break[/URL][COLOR= #007700]; }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{
{[/COLOR]
[COLOR= #0000BB]$title[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$item[/COLOR][COLOR= #007700]->[/COLOR]title[COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$link[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$item[/COLOR][COLOR= #007700]->[/COLOR][URL="http://www.php.net/link"]link[/URL][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$published_on[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$item[/COLOR][COLOR= #007700]->[/COLOR]pubDate[COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$description[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$item[/COLOR][COLOR= #007700]->[/COLOR]description[COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$title[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]40[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<h2>[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/substr"]substr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$title[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]30[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]</h2>[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<h2>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$title[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]</h2>[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div class="column_divider"></div>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<p>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$description[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] <a href="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$link[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" style="color: #0000ee;">Lees verder...</a></p>[/COLOR][COLOR= #007700];
}
}
}[/COLOR]
?> Daar moet dus op een of andere manier ingebouwd worden dat ie vanaf nummer 3 (of 4) start, dan kan ik tussen de feeds mooi een plaatje verwerken.
Ik hoop dat jullie me kunnen helpen met een passende oplossing!
Met vriendelijke groet,
Jos