SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    calif
    Posts
    743
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Trying to add header/footer to this page.

    I have header and footer showing on most web pages, but not this one added later. I tried copying a few lines from another page that HAS the header and footer appearing, but got many errors which I've listed below. (The page code shown below I've extracted some lines of private data)
    Any help with trying to add header and footer to it will be appreciated.

    Working page without header/footer:
    Code:
    <?php
    
    // Get Details
    $amount = $_POST['valu'];
    $credits = $_POST['cre'];
    $user_id = $_POST['uid'];
    $item_name = $_POST['itnm'];     
    
    // Include the paypal library
    include_once ('Paypal.php');
    
    // Create an instance of the paypal library
    $myPaypal = new Paypal();
    
    // Specify your paypal email
    
    // Specify the url where paypal will send the user on success/failure
    
    // Specify the url where paypal will send the IPN
    
    // Specify the product information
    $myPaypal->addField('item_name', $item_name);  
    $myPaypal->addField('amount', $amount);
    $myPaypal->addField('item_number', $credits);
    
    // Specify any custom value
    $myPaypal->addField('custom', $user_id);
    
    // Enable test mode if needed
    ///$myPaypal->enableTestMode();
    
    // Go
    $myPaypal->submitPayment();
    Added some lines from other page that has header/footer as an attempt,
    but got errors:

    Code:
    <?php
    (include_once ('classes/config.php'); 
    (include_once ('classes/sessions.php');
    // Get Details
    $amount = $_POST['valu'];
    $credits = $_POST['cre'];
    $user_id = $_POST['uid'];
    $item_name = $_POST['itnm'];     
    
    // Include the paypal library
    include_once ('Paypal.php');
    
    // Create an instance of the paypal library
    $myPaypal = new Paypal();
    
    // Specify your paypal email
    
    // Specify the url where paypal will send the user on success/failure
    
    // Specify the url where paypal will send the IPN
    
    // Specify the product information
    $myPaypal->addField('item_name', $item_name);  
    $myPaypal->addField('amount', $amount);
    $myPaypal->addField('item_number', $credits);
    
    // Specify any custom value
    $myPaypal->addField('custom', $user_id);
    
    // Enable test mode if needed
    ///$myPaypal->enableTestMode();
    
    // Go
    $myPaypal->submitPayment();
    The errors were:
    Warning: include_once(classes/config.php) [function.include-once]: failed to open stream: No such file or directory in /home/public_html/payment/thispage.php on line 3

    Warning: include_once() [function.include]: Failed opening 'classes/config.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/public_html/payment/thispage.php on line 3

    Warning: include_once(classes/sessions.php) [function.include-once]: failed to open stream: No such file or directory in /home/public_html/payment/thispage.php on line 4

    Warning: include_once() [function.include]: Failed opening 'classes/sessions.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/public_html/payment/thispage.php on line 4

    Any help/thoughts/suggestions will be appreciated.
    Last edited by ChrisjChrisj; Jul 9, 2009 at 17:13.

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,263
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    It sounds like a path, spelling/case problem. What depth are the files that are including OK, and what depth (i.e. under what folder) is the one with the problem?

  3. #3
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    calif
    Posts
    743
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your reply.
    To reply to you there are no files that are "including OK"
    The file that shows no header and footer is in a folder named Payment.

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,263
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    You mean
    Quote Originally Posted by ChrisjChrisj
    header and footer showing on most web pages, but not this one added later. I tried copying a few lines from another page that HAS the header and footer appearing,
    are not includes, but hard-coded in the pages?

    For PHP to find the included files, they either need to be under the directory the file is in
    PHP Code:
    <?php
    include_once 'classes/config.php'
    include_once 
    'classes/sessions.php';
    (your code has extra "("s and you don't need any for the language construct. include_once is not a function.)

    Or you could try ini_set-ting the path
    PHP Code:
    <?php
    ini_set
    (
        
    'include_path'ini_get('include_path') . ":" .
            
    $_SERVER['DOCUMENT_ROOT'] . "/path-to-includes/");
    include_once 
    'classes/config.php'
    include_once 
    'classes/sessions.php';
    using ":" or ";" and "/" or "\" depending on your server. Judgiing from the error messages, it doesn't look like you have a Windows server so the above should work for you.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •