Jump to content

n00b question about importing templates


Olivier Piechaczyk

Recommended Posts

Posted

Hello,

I'm new to ips (and php fwiw) and I have a hard time with it. If pretty sure the answer is somewhere in these forums / documentation, but I just couldn't find it (or understant it maybe...).

I am developping a website for a game and I use IPS community suite for its forum. But I would also like to use it to record scores etc... for users. So I would like that people could log from any page of the website / and have access to their id / name. I will put everything else in another database with these infos.

Having access to their name / id is ok, but I'd like to use the userBar template on every page and I don't understant how to make it work.

 

What I did :
 

//Get the init.php of ips

  require_once './community/init.php';

//Initiate session

 \IPS\Session\Front::i();

 

I have acces to the name / id with:
 

$player_id = \IPS\Member::loggedIn()->member_id;

$player_name = \IPS\Member::loggedIn()->name;

 

But the insertion of the template does not work:
 

//Import css / js of ips in the <head> section

    <?php
    echo \IPS\Theme::i()->getTemplate('global', 'core', 'global')->includeJS();
    echo \IPS\Theme::i()->getTemplate('global', 'core', 'global')->includeCSS();
    ?>

And get the template in the body (where I want it) :
 

<?php
echo \IPS\Theme::i()->getTemplate('global', 'core', 'front')->userBar();       
?>


Path seems ok since if I remove everything in the userbar template in the theme section (as Admin), page loads. but I only get an error when I try to load my page with full template.

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...