Dallby
Dallby

Reputation: 596

Silverstripe: Top.PageControllerFunction not displaying

I am using the Silverstripe Twitter module. It has a page controller function called LatestTweets($value) Which obviously displays the latest tweets.

When I add the Latest Tweets function to the Page.ss template. The tweets display. Everything works fine.

I am also using shaedawson's blocks module. I have a 'grid' block. The Grid Block has a template (Grid.ss) In the Templates Folder (templates/). When I add $Top.LatestTweets(3) to the Grid Template, the tweets do not appear.

Can anyone explain why this is happening?

Upvotes: 1

Views: 44

Answers (2)

Dallby
Dallby

Reputation: 596

I figured this out. The reason why the "Latest Tweets" function was not appearing on my template, was because I had to extend Block_Controller

I added the following to my 'extension.yml' file:

Block_Controller:
  extensions:
    - TwitterExtension

I would like to be able to 'include' the "Twitter Feed" template in my Grid Template. However this works and will do for now.

Upvotes: 0

Greg Smirnov
Greg Smirnov

Reputation: 1592

It works on any page controller, because the module tractorcow/silverstripe-twitter enables extension TwitterExtension on the Page_Controller in its configuration.

Blocks in sheadawson/silverstripe-blocks module are rendered with SiteTree context (the top scope) and your LatestTweets() function is not available.

So, the only remedy is to enable the TwitterExtension on your Page.

Upvotes: 2

Related Questions