Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Issue with Twitter feed not working when inside an <% include SidebarWidget %>


Go to End


818 Views

Avatar
Turismo

Community Member, 28 Posts

27 May 2016 at 2:06am

I've installed this Twitter feed https://github.com/tractorcow/silverstripe-twitter and it works perfect when called directly into my HomePage.ss, however when I call it from an include, nothing shows.

This is the code on the homepage (Twitter feed is located inside the $SidebarWidgets.First / SidebarWidget include):

<% if $SidebarWidgets %>
<section class="unit-list list-widgets">
	<div class="wrapper">
		<% loop $SidebarWidgets.Last %>
			<% include SidebarWidget %>
		<% end_loop %>
		<% with $Page(our-clients) %>
		    <% include SidebarWidget %>
		<% end_with %>
		<% loop $SidebarWidgets.First %>
			<% include SidebarWidget %>
		<% end_loop %>
	</div>
</section>
<% end_if %>

Here is my code for the include (SidebarWidget.ss):

<% if $ID = '2' %>
	<% if LatestTweets %>
	    <ul class="Tweets">
	        <% loop LatestTweets %>
	            <li class="Tweet">
	                <label>
	                    <a href="https://www.twitter.com/{$User}" target="_blank" class="User">@$User</a>
	                    $DateObject.format('d F Y')
	                </label>
	                <p>$Content</p>
	            </li>
	        <% end_loop %>
	    </ul>
	<% end_if %>
<% end_if %>

Any ideas what I'm doing wrong please?