XF 1.0 Editing Templates and Defining a Callback for Pages

When we debuted the Pages feature, it was intended to be a simple way to get some custom HTML onto a page surrounded by the standard XenForo user interface chrome. By the time we reached Beta 1, it had evolved into an altogether more powerful system.

Pages now support a PHP callback, so your pages can request data from the database and be used as a platform for building any kind of single-page application you might want to build. They also allow you to override the default and specify your own template to be rendered by the page, so the possibilities really are limitless.

This two-part video shows you the basics of building a simple application using the Pages system, and delves into the realms of the template editor to create and edit the custom HTML that will be used to display your page.

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

Having built a basic dynamic page, in this second part we add more functionality and data to the page including a sidebar and a list of the authors of the most recent posts. In doing so, we look into advanced template syntax use, and reveal one of XenForo's hidden treasures.

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

Part 3
I've just uploaded a third part, answering some questions that have come up:

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

... and created a new answer post here:
http://xenforo.com/community/threads/random-questions-answered.114/page-2#post-102179
 
Hi,

I followed the tutorial and I got the same issue as some other members posted. And i replace this line of the code,

Code:
$response->params['users'] = $userModel->getLatestUsers(array(), array('limit'=> 5));

with this line,

Code:
$response->params['onlineUsers'] = $userModel->getLatestUsers(array(), array('limit'=> 5));

but still facing the same error
  1. Invalid argument supplied for foreach() in /var/www/html/xf/library/XenForo/Template/Abstract.php(265) : eval()'d code, line 461:
    460: ';
    461: foreach ($onlineUsers['records'] AS $user)
    462: {

Please help.
 
Top Bottom