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 8890851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:35:48+00:00 2026-06-14T22:35:48+00:00

I’m trying to load a library with the name Single_column. I create this library

  • 0

I’m trying to load a library with the name Single_column. I create this library and I set it into the libraries folder. I have to mention at this point that I;m using the code Igniter framework. The Sinle_column class contain the following code:

 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 

class Single_column
{
    public function render( $id )
    {
        $CI =& get_instance();

        // DB calls
        // search for uri in db
        $CI->load->model('m_single_column');
        $image = $CI->m_single_column->getImageURI( $id );
        $text = $CI->m_single_column->getText( $id );

        // ==== HEADER
        // eventually, this will be loaded from the db
        $header_data['title'] = "Single Column Demo";
        $header_data['css'][] = "single_column";
        $CI->load->view('v_header', $header_data);

        // ==== CONTENT
        $content_data['content'] = '<div class="content-block">';
        $content_data['content'] .= '<div class="image">';
        $content_data['content'] .= '<img src="' . base_url() . $image . '" width="200" height="133" alt="my tractor"/>';
        $content_data['content'] .= '</div>';
        $content_data['content'] .= $text;
        $content_data['content'] .= '</div><!-- end content-block-->';

        $CI->load->view('v_content', $content_data);

        // ==== FOOTER
        $CI->load->view('v_footer');
    }
  }

 ?>

Now into the controller folder I have a class with the name:

 <?php

 if (!defined('BASEPATH'))
    exit('No direct script access allowed');

 class Master extends CI_Controller {

    function __construct() {
       parent::__construct();

     }

public function _remap($method) {
    // remap overrides function calls 
    // search for uri in db

    $this->load->model('m_master');

    $uri_id = $this->m_master->findURI(uri_string());
    $page;
    if ($uri_id != false) {       
        $this->{$page->controller}->render( $page->id );
    } else {
        show_404(uri_string());
    }
}

}

?>

The aforementioned code is from a tutorial and my problem is at the following line:

  $this->{$page->controller}->render( $page->id );

The displayed error is the following one:

   Fatal error: Cannot access empty property in C:\xampp\htdocs\PhpProject1\application\controllers\master.php on line 24

Actually I realized that it can’t recognize the method ‘render’.
So, I tried the following lines of code into the if statement

  $library= Single_column::$uri_id['id'];;
  $this->load->library($library);

But I received the following error:
Fatal error: Class ‘Single_column’ not found in C:\xampp\htdocs\PhpProject1\application\controllers\master.php on line 22

Moreover, the $uri_id returns an sql object. ButI want to pass only the id attribute of the object.

Question: How Can I call a library? And how can I pass a value into a method of a class(render method)? Why the aforementioned lines that didn’t work?

  • 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-14T22:35:49+00:00Added an answer on June 14, 2026 at 10:35 pm

    Not sure why you’re loading a model into a library.

    Make sure your library is also stored in application/libraries

    $this->load->library('your_library_name');
    $this->your_library_name->render($page->id);
    

    This is similar to loading CodeIgniter libraries.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.

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.