1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Online users template in a page

Discussion in 'XenForo Development Discussions' started by grantus, Apr 8, 2016.

  1. grantus

    grantus Active Member

    Hi,

    I have a custom page where I'm trying to show the online users, and I'm able to do it by putting this:

    Code:
    <xen:include template="sidebar_online_users"></xen:include>
    inside the pagenode_container template. It shows but the problem is I get this error:

    Code:
    Invalid argument supplied for foreach() in E:\home\www\library\XenForo\Template\Abstract.php(265) : eval()'d code, line 274:
    273:                     ';
    274: foreach ($onlineUsers['records'] AS $user)
    275: {
    Any ideas on the error and how I can properly include the online users in a page?

    Thanks.
     
  2. Mike

    Mike XenForo Developer Staff Member

    You can't just include the template. You'd need to add custom PHP code to your controller to fetch the data that the template uses.
     
  3. Steve F

    Steve F Well-Known Member

  4. grantus

    grantus Active Member

    Ok thanks. I thought for sure I had done it a while ago with a style I was creating. Ah well.
    Yeah that's my backup plan, I'll just use that instead. Thanks.
     

Share This Page