1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. To combat forum spam, new accounts will need to make at least one (valid) post.
    Otherwise, we will periodically purge all users without posts or that haven't confirmed their account.

Integration with PHPBB

Discussion in 'General' started by Guzik, Apr 3, 2008.

Thread Status:
Not open for further replies.
  1. Hi! First off I'd like to say how great of a product this looks, and that I'm really looking forward to implementing it in to my gaming clan's website as a calendar management system! :) However, to ensure that this meets my needs I've run into one problem with the trial.

    I figured all the newbie problems I was having by playing with it on my main page (www.lt3clan.com). Now I went to move the code over into our forums (phpbb3 @ www.lt3clan.com/forum). Then I realized the difficulties of having php pull html files as a template and do not know how to make it work!

    I'm trying to have the calendar float at the top left of the page - on every page.

    To have it working on the home page of our website (not the forums)... I had the following in the header:

    Code:
    <?php $CSS=1; require("calendar/calendar.php"); ?>
    <?php $EPCAJAX=1; require("calendar/calendar.php"); ?>
    
    
    
    <style type="text/css">
    
    #topbar{
    position:absolute;
    visibility: hidden;
    z-index: 100;
    }
    
    </style>
    
    <script type="text/javascript">
    
    /***********************************************
    * Floating Top Bar script- © Dynamic Drive (www.dynamicdrive.com)
    * Sliding routine by Roy Whittle (http://www.javascript-fx.com/)
    * This notice must stay intact for legal use.
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    var persistclose=0 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session
    var startX = 5 //set x offset of bar in pixels
    var startY = 5 //set y offset of bar in pixels
    var verticalpos="fromtop" //enter "fromtop" or "frombottom"
    
    function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }
    
    function get_cookie(Name) {
    var search = Name + "="
    var returnvalue = "";
    if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) {
    offset += search.length
    end = document.cookie.indexOf(";", offset);
    if (end == -1) end = document.cookie.length;
    returnvalue=unescape(document.cookie.substring(offset, end))
    }
    }
    return returnvalue;
    }
    
    function closebar(){
    if (persistclose)
    document.cookie="remainclosed=1"
    document.getElementById("topbar").style.visibility="hidden"
    }
    
    function staticbar(){
        barheight=document.getElementById("topbar").offsetHeight
        var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
        var d = document;
        function ml(id){
            var el=d.getElementById(id);
            if (!persistclose || persistclose && get_cookie("remainclosed")=="")
            el.style.visibility="visible"
            if(d.layers)el.style=el;
            el.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";};
            el.x = startX;
            if (verticalpos=="fromtop")
            el.y = startY;
            else{
            el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
            el.y -= startY;
            }
            return el;
        }
        window.stayTopLeft=function(){
            if (verticalpos=="fromtop"){
            var pY = ns ? pageYOffset : iecompattest().scrollTop;
            ftlObj.y += (pY + startY - ftlObj.y)/8;
            }
            else{
            var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;
            ftlObj.y += (pY - startY - ftlObj.y)/8;
            }
            ftlObj.sP(ftlObj.x, ftlObj.y);
            setTimeout("stayTopLeft()", 10);
        }
        ftlObj = ml("topbar");
        stayTopLeft();
    }
    
    if (window.addEventListener)
    window.addEventListener("load", staticbar, false)
    else if (window.attachEvent)
    window.attachEvent("onload", staticbar)
    else if (document.getElementById)
    window.onload=staticbar
    </script>
    
    Then in the body I had:

    Code:
    <?php $OL=1; require("calendar/calendar.php"); ?>
    <div id="topbar"><div id="EPCcalendar"><?php $EPCajax=1; require("calendar/calendar.php"); ?></div></div>
    Before I buy the program, I'd like to make sure I can get it working! :) Thank you all.
  2. ve9gra

    ve9gra Support Team

    Seems like you've got the hard part figured out. I have never integrated the calendar with PHPBB, let alone PHPBB3, so I'd probably be just as lost as you.

    However, I've had to deal with the templating engines from PHP-Nuke (xanthia), so I'm assuming it would be somewhat similar. What I had to do there was figure out if the templating system used plugins, and then create a plugin that would generate the EPC bits that are needed. Then I'd simply call the plugin in the templates and made it work.

    I believe you're the one that contacted me regarding PHPBB3, correct? I would have to spend a significant amount of time with it to be comfortable in giving you a solution... but I can help you along.
  3. PHPBB3 does use plugins (very similar to the way the original PHPBB did). I think I follow what you're saying and it sounds correct from my limited knowledge. I think I may be able to figure parts of it out. Trial and error for the win! :)

    Maybe we could work together on the task to find a solution, I really can't imagine it being that difficult. Do you have another sort of contact information (AIM/MSN/Steam). I also have a Ventrilo (voip) server of my own which would allow us to talk back and forth a la Skype.

    Thank you for the quick reply and I look forward to hearing again from you.
  4. ve9gra

    ve9gra Support Team

    I've downloaded PHPBB3 and I'm starting to look into how its system works, but it will take me a while to figure it all out. I've also looked into other calendar plugins for it to see how they work, but they are entirely different from EPC that I will probably not be able to use any of their code as a base.

    I do have AIM, but I'll send that to you via email.
  5. ve9gra

    ve9gra Support Team

    Got it! It was actually a lot easier than I thought :)

    All that was needed was using the tags <!-- PHP --> and <!-- ENDPHP --> instead of the regular <?php and ?> tags. Then on the General tab in your ACP, under the Server Configuration, click Security Settings. On that page, set "Allow php in templates:" to YES.

    That's it. If you're really averse to allowing PHP in your templates, then we'll have to go the plugin route, but this gets you going right now.

    PS: btw, that effect is really cool... I might use that myself :)
    Last edited: Apr 4, 2008
  6. Awesome ve9gra, I got it up and running on my site now @ www.lt3clan.com/forum

    The only problem is now I notice that it's funking up some of the title/text calls. Notice at the top, below the banner:
    { FAQ } [​IMG] { SEARCH } [​IMG] { MEMBERLIST } [​IMG] { PROFILE }

    Text like that is appearing throughout the page. When I take the calendar out, it goes back to being fine. Wondering if I'm putting something somewhere wrong (I've moved it all over the place trying to fix it). It's all edited in:
    http://www.lt3clan.com/forum/styles/AnimeZone/template/overall_header.html


    Here's an example of an working version:
    http://www.phpbbireland.com/phpBB3/styles/AnimeZone/template/overall_header.html

    I think the javascript or CSS's are messing with it?
  7. ve9gra

    ve9gra Support Team

    I had missed that one. I guess I was fixated on the calendar once I got it to show up that I wasn't looking at the rest of the site.

    I managed to point the problem to the calendar itself - there's a conflict with the language file of PHPBB. In order to have those play together, I had to use the function isolation. Also, to clean the page up a bit, I moved the JavaScript out to a file of its own. So here's the bits of code that I have now:

    This is right before the </head> tag in overall_header.php
    PHP:
    <!-- PHP -->
    function 
    epcOutHead() {
      global 
    $phpbb_root_path;
      require(
    $phpbb_root_path."calendar/config.inc.php");
      
    $CSS=1; require($phpbb_root_path."calendar/calendar.php");
      
    $EPCAJAX=1; require($phpbb_root_path."calendar/calendar.php");
    }
    epcOutHead();
    <!-- 
    ENDPHP -->

    <
    script type="text/javascript" src="{T_TEMPLATE_PATH}/float-calendar.js"></script>
    </head>
    You can see I named the JavaScript file "float-calendar.js", but you can name it whatever you want. The file is put directly in the /styles/*your-theme*/template folder. The little bit of CSS that was part of it (the #topbar), I've moved that bit directly to the calendar's /calendar/theme/default/esstyle.css

    Next is the part that goes right after the <body> tag, and right below that is the DIV with the $EPCajax:
    PHP:
    <body id="phpbb" class="section-{SCRIPT_NAME} {S_CONTENT_DIRECTION}">
    <!-- 
    PHP -->
    function 
    epcOutBody() {
      global 
    $phpbb_root_path;
      require(
    $phpbb_root_path."calendar/config.inc.php");
      
    $OL=1; require($phpbb_root_path."calendar/calendar.php");
    }
    epcOutBody();
    <!-- 
    ENDPHP -->
    <
    div id="topbar"><div id="EPCcalendar">
    <!-- 
    PHP -->
    function 
    epcOutCalendar() {
      global 
    $phpbb_root_path;
      require(
    $phpbb_root_path."calendar/config.inc.php");
      
    $EPCajax=1; require($phpbb_root_path."calendar/calendar.php");
    }
    epcOutCalendar();
    <!-- 
    ENDPHP -->
    </
    div></div>
    You'll see that I've added a require of config.inc.php in each function. This is needed because otherwise the calendar doesn't get to have its variables as they are not shared between the functions.

    So using this format you can pretty much add anything you want. Create a function with a unique name, put the code you want inside of it with the require of config.inc.php as the first thing, and right below the function you call it.

    Now, I found that there's another issue... if the calendar is there you can't access the ACP. I'll try to find what's the best way to get the path. I'll post back as soon as I figure that one out. - Disregard this

    I've updated the code in the post with what works. Tried, tested, and working.
    Last edited: Apr 5, 2008
  8. Thank you so much ve9gra for all of your help, it's working flawlessly now.

    My clan didn't like the scrolling (GAAHHHHH!), so I integrated it into the banner with blog mode. That took up too much space, so I put right back into that corner it was originally, but took off the scrolling - and now everyone is happy! :D

    ---Nevermind, I got my license working properly! <3---

    Thanks again, you're awesome! <3
    Last edited: Apr 6, 2008
  9. ve9gra

    ve9gra Support Team

    All you'll have to do is enter your new license in the Setup Manager. That's it.
Thread Status:
Not open for further replies.

Share This Page