SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2011
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What could cause an object not be passed down included files?

    Hello,

    In wordpress: index.php
    PHP Code:
    <?php 
        
    require_once 'Test/Test.php';
    $test = new Test();

    <?
    php get_template_part'main' ); ?>
    ?>
    For a reason I don't understand, I have to re-include and re-instantiate Test() in main.php.

    Shouldn't the class be available everywhere?

    Cheers.


  2. #2
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    What does your class or function do? That could be the reason.
    Ryan B | My Blog | Twitter


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
  •