Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7889169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:01:38+00:00 2026-06-03T06:01:38+00:00

I took good care to create this class but I am not sure what

  • 0

I took good care to create this class but I am not sure what is wrong with it. The code runs perfectly if I don’t have any content inside,

class TemplateOne{

}

But once I run this code it breaks,

<?php

class TemplateOne {

    //Properties
    protected $_bgColor;
    protected $_logoImagePath;
    protected $_headerText;
    protected $_leftContentHeader;
    protected $_rightContentHeader;
    protected $_leftContentBody;
    protected $_rightContentBody;
    protected $_footer;
    protected $_mediaIframe;
    protected $_mediaHeight = '';
    protected $_mediaWidth = '';

    //DB communication
    public $DB;

    //Constructor
    public function __construct(){

        //Connect database in construct and close connection in destruct

        $config = array();

        $config['host'] = 'localhost';
        $config['user'] = 'root';
        $config['pass'] = 'root';
        $config['database'] = 'fanpage_application';

        $this->DB = new DB($config);

        //init variables
        populateDataFromDataBase();
    }

    //Functions
    public function populateDataFromDataBase() {

        //Get bgcolor
        $this->DB->("SELECT backgroundimage FROM template_style_data WHERE styleid='#list_level'");
        $data = $this->DB->Get();
        foreach($data as $key => $value)
        {
            echo $value['backgroundimage'];
        }
    }

    //Getters
    public function getBgColor()
    {
        return $this->_bgColor;
    }

    public function getLogoImagePath()
    {
        return $this->_logoImagePath;
    }

    public function getHeaderText()
    {
        return $this->_headerText;
    }

    public function getLeftContentHeader()
    {
        return $this->_leftContentHeader;
    }

    public function getRightContentHeader()
    {
        return $this->_rightContentHeader;
    }

    public function getLeftContentBody()
    {
        return $this->_leftContentBody;
    }

    public function getRightContentBody()
    {
        return $this->_rightContentBody;
    }

    public function getFooter()
    {
        return $this->_footer;
    }

    public function getMediaIframe()
    {
        return $this->_mediaIframe;
    }

    //Setters

    public function setBgColor($bgColor)
    {
         $this->_bgColor = $bgColor;
    }

    public function setLogoImagePath($logoImagePath)
    {
         $this->_logoImagePath = $logoImagePath;
    }

    public function setHeaderText($headerText)
    {
         $this->_headerText = $headerText;
    }

    public function setLeftContentHeader($leftContentHeader)
    {
         $this->_leftContentHeader = $leftContentHeader;
    }

    public function setRightContentHeader($rightContentHeader)
    {
         $this->_rightContentHeader = $rightContentHeader;
    }

    public function setLeftContentBody($leftContentHeader)
    {
         $this->_leftContentBody = $leftContentHeader;
    }

    public function setRightContentBody($rightContentBody)
    {
         $this->_rightContentBody = $rightContentBody;
    }

    public function setFooter($footer)
    {
         $this->_footer = $footer;
    }

    public function setMediaIframe($mediaIframe)
    {
         $this->_mediaIframe = $mediaIframe;
    }

}

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:01:39+00:00Added an answer on June 3, 2026 at 6:01 am

    Where is the DB class coming from? You may have to include the correct class definition file if it is not already.

    $this->DB = new DB($config);
    

    The following is not legal syntax. You will need to actually call a function by name.

    $this->DB->("SELECT backgroundimage FROM template_style_data WHERE styleid='#list_level'");
    

    Unless you have another function in the global scope named populateDataFromDataBase which is what you want to call, you will need to add $this-> before you try to call it in your constructor.

    populateDataFromDataBase();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Now, this might seem fairly simple at first, but took good amount of time
I took this code from Facebook's documentation to get me started in learning how
Recently, i took ownership of some c++ code. I am going to maintain this
It took a good bit of trial and error, but I was finally able
The Scenario I have an application where we took the good old query string
I took a class named Secure Code, and in our next assignment we are
I took over an ASP.NET application and have found this throughout several classes in
Does anyone have a good method for approving people who took part in a
I took the example code from the Kendo UI demos at http://demos.kendoui.com/web/grid/remote-data.html , binding
I took a look at this answer and it goes in part to solving

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.