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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:43:29+00:00 2026-06-11T08:43:29+00:00

I’m trying to setup the Widget plugin by wiredesignz at http://codeigniter.com/forums/viewthread/109584/P20 but I keep

  • 0

I’m trying to setup the Widget plugin by wiredesignz at http://codeigniter.com/forums/viewthread/109584/P20 but I keep getting the error. I am pretty sure I have everything setup as directed in the thread, but I’m getting the following when I try <?php widget::run("test"); ?> in my view:

class Test extends Widget { function run() { echo "test"; } } 
Fatal error: Class 'Test' not found in C:\xampp\htdocs\test\application\helpers\widget_helper.php on line 52

The only thing I can think of that is different about my install is that I’m using Phil Sturgeon’s template library.

Here is how I have everything structured:

/application/helpers/widget_helper.php

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Widget Plugin 
 * 
 * Install this file as application/plugins/widget_pi.php
 * 
 * @version:     0.21
 * $copyright     Copyright (c) Wiredesignz 2009-09-07
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
class Widget
{
    public $module_path;

    function run($file) {        
        $args = func_get_args();

        $module = '';

        /* is module in filename? */
        if (($pos = strrpos($file, '/')) !== FALSE) {
            $module = substr($file, 0, $pos);
            $file = substr($file, $pos + 1);
        }

        list($path, $file) = Modules::find($file, $module, 'widgets/');

        if ($path === FALSE) {
            $path = APPPATH.'widgets/';
        }

        Modules::load_file($file, $path);

        $file = ucfirst($file);
        $widget = new $file();

        $widget->module_path = $path;

        return call_user_func_array(array($widget, 'run'), array_slice($args, 1));    
    }

    function render($view, $data = array()) {
        extract($data);
        include $this->module_path.'views/'.$view.EXT;
    }

    function load($object) {
        $this->$object = load_class(ucfirst($object));
    }

    function __get($var) {
        global $CI;
        return $CI->$var;
    }
} 

/application/widgets/test.php

class Test extends Widget {

    function run() {
        echo "test";
    }

} 

/application/views/layouts/public.php

<?php widget::run("test"); ?>

Any idea how I can get this working? Is this just outdated?

I’ve been searching for a better solution to do Widgets but I can’t seem to find any. I just need to be able to control what appears on the site sidebar on a page-by-page basis. Are there any alternative methods?

EDIT: Error’s from widget library in comments

A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Lang::$active_lang

Filename: libraries/widgets.php

Line Number: 26

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Page::$sys_lib

Filename: libraries/widgets.php

Line Number: 87

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: libraries/widgets.php

Line Number: 27

A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Lang::$active_lang

Filename: libraries/widgets.php

Line Number: 26

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Page::$sys_lib

Filename: libraries/widgets.php

Line Number: 87

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: libraries/widgets.php

Line Number: 27
  • 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-11T08:43:30+00:00Added an answer on June 11, 2026 at 8:43 am

    Hi try my widget library it will work for you, it work with loader

    Widget Library

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
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 want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
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

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.