Not signed in (Sign In)

Categories

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthordandean
    • CommentTimeAug 15th 2005
     # 1
    I'm having trouble including a file into Vanilla. I have a file that is used on the rest of my site that defines standard variables, $domain, $root_virtual, etc. I can't seem to find the right place to put the include(); call within the Vanilla code. When I do put it in there I get "undefined index" warnings that refer to $_SERVER['REQUEST_URI'] and $_SERVER['HTTPS'].

    Any ideas on what the correct place to include this file would be so that I can access it throughout vanilla?
    •  
      CommentAuthorlech
    • CommentTimeAug 15th 2005
     # 2
    perhaps a brief explanation of what it is you're pulling into vanilla and via what method? is this an extension?
    •  
      CommentAuthorMark
    • CommentTimeAug 15th 2005
     # 3
    Also, please copy and paste the actual errors. Paraphrased errors can be very misleading.
    • CommentAuthordandean
    • CommentTimeAug 16th 2005 edited
     # 4
    Here's a more concise explanation of the problem:

    I'm integrating Vanilla into a site that I'm building that uses my own custom CMS which uses some sitewide navigation, varables, images, etc. The include that deals with sitewide variables (_core.php) is causing problems when included into Vanilla. Below are the relevant code snippets:

    I've figured out the $_SERVER['REQUEST_URI'] issue, but the $_SERVER['HTTPS'] one is still killing me.

    Code within include file that causes error:
    15: // 1 = server is running SSL | 0 = not running SSL
    16: $HasSSL = ($_SERVER['HTTPS']=='on') ? 1 : 0;
    =======
    24: $domainSSL = ($_SERVER['HTTPS']=='on') ? 'https://'. $_SERVER['SERVER_NAME'] : 'http://'. $_SERVER['SERVER_NAME'];


    Include() call within class Menu's Render() function:
    function Render() {
    // First sort the tabs by key
    ksort($this->Tabs);
    // Now write the Menu
    $this->Context->Writer->Add("< div class="SiteContainer">
    < a name="pgtop"></a>
    < div id="LoadStatus" style="display: none;">Loading...</ div>");

    $this->Context->Writer->Add("
    < div class="Head">
    <!-- &lt; div class=&quot;Logo&quot;&gt;&quot;.agBANNER_TITLE.&quot;&lt;/ div&gt; -->");


    $this->Context->Writer->Write();

    // inside this file is the call to include _core.php
    <strong style='color:red;'>include("./inc/sitenav.php");</strong>

    $this->Context->Writer->Add("
    < ul id="MenuForum">");
    while (list($Key, $Tab) = each($this->Tabs)) {
    $this->Context->Writer->Add($this->FormatTab($Tab["Text"], $Tab["Value"], $Tab["Url"], $Tab["CssClass"], $Tab["Attributes"]));
    }
    $this->Context->Writer->Add("</ ul>
    </ div>
    < div class="Body">");
    $this->Context->Writer->Write();
    }


    The error's thrown:
    Notice: Undefined index: HTTPS in /usr/local/apache/htdocs/_php/_core.php on line 16

    Notice: Undefined index: HTTPS in /usr/local/apache/htdocs/_php/_core.php on line 24
    •  
      CommentAuthorMark
    • CommentTimeAug 16th 2005
     # 5
    This is actually an error in your other program due to lack of error checking. The $_SERVER collection on your machine doesn't have the HTTPS index defined, and that other software assumes that it does.

    Do you use https? If not, the easy way to get rid of these errors is to prefix the $_SERVER["https"] with an @ symbol, like this:

    @$_SERVER["https"]

    That will prevent your errors from being dumped to the screen.
    • CommentAuthordandean
    • CommentTimeAug 16th 2005 edited
     # 6
    Thanks mark, you were correct about the underlying problem. I've added some error correction to my files to correct it:

    if (array_key_exists('HTTPS', $_SERVER)) {
    $HasSSL = ($_SERVER['HTTPS']=='on') ? 1 : 0;
    } else {
    $HasSSL = 0;
    }


    I know it seems a little bit redundant, but it gets the job done without breaking the rest of the site. And, I wonder why I wasn't getting the error anywhere else on the site? Thanks again for your input, it's quite appreciated!
    •  
      CommentAuthorMark
    • CommentTimeAug 16th 2005
     # 7
    In Vanilla I have overridden the default php.ini error_reporting setting so that it now reports all errors. I do this so that bugs are easier to track down in Vanilla - since, after all, there should never be any bugs - and if there are, I want to find and fix them.
    • CommentAuthordandean
    • CommentTimeAug 16th 2005
     # 8
    but what about people like me who LOVE to write super buggy software?
    •  
      CommentAuthorMark
    • CommentTimeAug 16th 2005
     # 9
    hahaha
Add your comments
    Username Password
  • Format comments as