SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist
    Join Date
    Jun 2008
    Posts
    455
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can't figure out the problem

    Hi,

    I've got 2 classes; website and wireframe.
    When I call wireframe within the __construct() function of website my entire page goes blanks.

    Wireframe doesn't have any thing in it apart top 2 empty functions top() and bottom().

    Any idea why my page is blank?

    BTW, i have error reporting on.

    Thanks,
    Michael

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Code pweese.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Evangelist
    Join Date
    Jun 2008
    Posts
    455
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok

    Call the class in index.php
    PHP Code:
    <?php

    error_reporting
    (E_ALL E_STRICT);

    require_once(
    './classes/class.website.php');
    $website = new website();
    $website->render_site();

    echo(
    "<pre>");print_r($website);echo("</pre>");

    ?>
    This is the class: website
    PHP Code:
    <?php

    class website
    {

        static 
    $base_url;
        static 
    $base_root;
        static 
    $db_connection;

        var 
    $strtop;
        var 
    $strbot;
        var 
    $wireframe;
        
    //var $structure_bottom;

        
    public function __construct()
        {
            
            
    // Create base root.
            
    self::$base_root $_SERVER['DOCUMENT_ROOT'];

            
    // Get classes.
            
    require_once( '../db_conn_vars.inc' );
            require_once( 
    self::$base_root '/classes/class.database.php' );
            require_once( 
    self::$base_root '/classes/class.structure.php' );
            
            
    // Connect to database
            
    self::$db_connection = new database'mysql'DBHOST DEFAULT_DATABASE DBUSERNAME DBPASSWORD );

            
    $this->wireframe = new wireframe();
            
        }

        public function 
    render_site()
        {

            echo 
    'rendersitehere';

        }

    }

    ?>
    And.. this is the class: wireframe
    PHP Code:
    <?php

    class wireframe extends website
    {

        function 
    top(){}
        function 
    bottom(){}

    }

    ?>
    Any ideas?

  4. #4
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Sure, it's recursive.

    As wireframe extends website, when you create a new wireframe in the website constructor, wireframe calls the website constructor, which creates a new wireframe, which calls websites constructor, which....


    Well, you get the point.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  5. #5
    SitePoint Evangelist
    Join Date
    Jun 2008
    Posts
    455
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah, im a tool .

    Thanks for pointing that out


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
  •