Welcome Guest, Not a member yet? Register   Sign In
Custom library extending custom libraries
#15

[eluser]patbert[/eluser]
Now I have another issue.
Shared.php
Code:
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');

class Shared {

    function __construct() {
        $this->ci =& get_instance();
        $this->ci->config->load('movie');

        $this->titletbl = $this->ci->config->item('titles_table');
        $this->codectbl = $this->ci->config->item('codec_table');
        $this->cntnrtbl = $this->ci->config->item('container_table');
        $this->drctrtbl = $this->ci->config->item('director_table');
        $this->disctbl  = $this->ci->config->item('disc_table');
        $this->dsctptbl = $this->ci->config->item('disc_type_table');
        $this->genretbl = $this->ci->config->item('genre_table');
        $this->qualtbl  = $this->ci->config->item('quality_table');
        $this->cntrytbl = $this->ci->config->item('country_table');
        $this->cstmtbl  = $this->ci->config->item('custom_table');
        $this->cstmrtbl = $this->ci->config->item('custom_relation_table');

        $this->custom_field_prefix = $this->ci->config->item('custom_field_prefix');

        $this->imdb_title_root = $this->ci->config->item('imdb_title_root');
        $this->imdb_name_root  = $this->ci->config->item('imdb_name_root');

        $this->image_dir       = $this->ci->config->item('image_dir');

    }

    function make_site_link($uri, $id, $linktext) {
        $site_link_html = '<a href="' . site_url($uri . $id) . '">' . $linktext . '</a>';
        return $site_link_html;
    }
}

Then Title.php
Code:
&lt;?php if (! defined('BASEPATH')) exit('No direct script access allowed');

load_class('Shared', false);

class Title extends Shared {

    private function get_custom_field_names() {
        $striplen = strlen($this->custom_field_prefix);

        $field_list = $this->ci->db->list_fields($this->titletbl);

        foreach ($field_list as $field) {
            if (strpos($field, $this->custom_field_prefix) !== false) {
                $fields[] = $field;
            };
        };

        if (! empty($fields)) {
            $this->custom_field_names->fields = (object) $fields;
            $this->custom_field_names->striplen = $striplen;
        };

    }

}

There is a bunch of other stuff I cut out. The problem is that in the get_custom_field_names() function when it tries to read $this->custom_field_prefix I get an error that it is an undefined property.


Messages In This Thread
Custom library extending custom libraries - by El Forum - 03-31-2008, 05:36 AM
Custom library extending custom libraries - by El Forum - 03-31-2008, 05:40 AM
Custom library extending custom libraries - by El Forum - 03-31-2008, 05:42 AM
Custom library extending custom libraries - by El Forum - 03-31-2008, 05:43 AM
Custom library extending custom libraries - by El Forum - 03-31-2008, 05:46 AM
Custom library extending custom libraries - by El Forum - 03-31-2008, 05:52 AM
Custom library extending custom libraries - by El Forum - 03-31-2008, 06:21 AM
Custom library extending custom libraries - by El Forum - 03-31-2008, 07:31 AM
Custom library extending custom libraries - by El Forum - 05-03-2008, 02:12 PM
Custom library extending custom libraries - by El Forum - 05-03-2008, 02:37 PM
Custom library extending custom libraries - by El Forum - 05-03-2008, 02:42 PM
Custom library extending custom libraries - by El Forum - 05-03-2008, 02:48 PM
Custom library extending custom libraries - by El Forum - 05-03-2008, 02:54 PM
Custom library extending custom libraries - by El Forum - 05-03-2008, 03:02 PM
Custom library extending custom libraries - by El Forum - 05-03-2008, 03:45 PM
Custom library extending custom libraries - by El Forum - 05-03-2008, 03:58 PM
Custom library extending custom libraries - by El Forum - 05-03-2008, 04:06 PM
Custom library extending custom libraries - by El Forum - 05-03-2008, 04:13 PM
Custom library extending custom libraries - by El Forum - 05-03-2008, 04:20 PM
Custom library extending custom libraries - by El Forum - 05-03-2008, 04:39 PM
Custom library extending custom libraries - by El Forum - 05-03-2008, 04:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB