Hi all,
Some time ago I figured out how to place new site content (resources, articles) in a dashboard widget. I thought I share it with you all.
In my case I would like a dashboard widget which shows me the newest 10 resources from a container (in my case these are the latest 10 nominations). It looks like this:
1. Create a dashboard widget
Widget type: inline PHP widget
Widget content:
$output = $modx->runSnippet('getResources',array(
'parents' => '938',
'showHidden' => '0',
'limit' => '10',
'includeContent' => '1',
'sortby' => 'id',
'where' => '{"template:=":7}',
'tpl' => 'newResourcesWidget'
));
return $output;
2 Create chunk newResourcesWidget:
<strong>[[+longtitle]] on [[+createdon:strtotime:date=`%e %b %Y om %R`]]</strong>
<br />
<a href="[[++manager_url]]?a=resource/update&id=[[+id]]">[[+pagetitle]]</a> - [[+content]]
<br /><br />
Clicking on the link takes you directly to the page in the manager.
Of course some CSS could be added to make it look more fancy.
Feel free to alter the code to your needs!
[ed. note: michelle84 last edited this post 10 years, 8 months ago.]