Welcome Guest, Not a member yet? Register   Sign In
  No results when paginate (WHERE something=$something)
Posted by: El Forum - 06-29-2007, 04:06 PM - No Replies

[eluser]Gabriel P[/eluser]
Hello,

I wish to grab some articles from db WHERE parentid=$catid. The thing is i want to paginate them. So, i believe i did not write the correct code.

Here is my function from the controller:

Code:
function showArtByCat($catid)
    {  
        $data['base_url'] = $this->config->item('base_url');
        
        $data['cats'] = $this->Catmodel->getCats();
        $data['subcats'] = $this->Catmodel->getSubCats($catid);
        $data['catname'] = $this->Catmodel->getCatName($catid);
        
        
        $query = $this->db->query("SELECT COUNT(*) AS count FROM articles WHERE (parentid=".$catid.")");
        $row = $query->row();
        $total_rows = $row->count;

        $per_page = 10;
        $this->db->use_table('articles');
        $this->db->limit($per_page);
        
        if ($this->uri->segment(3) !== FALSE)
        {
            $this->db->offset($this->uri->segment(3));
        }          
        $data['query'] = $this->db->get();

        $config['base_url'] = 'my_base_url';
        $config['total_rows'] = $total_rows;
        $config['per_page'] = $per_page;

        $this->pagination->initialize($config);
        $data['paginate'] = $this->pagination->create_links();
        
        $this->load->view('front/cat', $data);
    }

Could somebody help me? I think i`m tired and i can`t figure it out.

Thanks,
Gabriel


  More apps like Bamboo Invoice ?
Posted by: El Forum - 06-29-2007, 02:53 PM - No Replies

[eluser]CI shocki[/eluser]
Hi guys,

Personally I have learned quite alot form Derek Allards "Bamboo Invoice". If anybody has something similar please share it. Would be nice to have some public source codes.

Thanks alot.
Regards Jan...


  [Fixed]
Posted by: El Forum - 06-29-2007, 01:41 PM - No Replies

[eluser]Unknown[/eluser]
Got it figured out!


  Question about CI_Base class
Posted by: El Forum - 06-29-2007, 10:35 AM - No Replies

[eluser]Michael Ekoka[/eluser]
I noticed that the CI_Base class forks for the 2 versions:

This is the v5 CI_Base content:

Code:
class CI_Base {

    private static $instance;

    public function CI_Base()
    {
        self::$instance =& $this;
    }

    public static function &get_instance()
    {
        return self::$instance;
    }
}

function &get_instance()
{
    return CI_Base::get_instance();
}
now this is v4:
Code:
class CI_Base extends CI_Loader {

    function CI_Base()
    {
        // This allows syntax like $this->load->foo() to work
        parent::CI_Loader();
        $this->load =& $this;
        
        // This allows resources used within controller constructors to work
        global $OBJ;
        $OBJ = $this->load; // Do NOT use a reference.
    }
}

function &get_instance()
{
    global $CI, $OBJ;
    
    if (is_object($CI))
    {
        return $CI;
    }
    
    return $OBJ->load;
}

My question is the following, is there a particular reason why we couldn't adapt v4 CI_Base to emulate v5 like this. This is strictly out of technical curiosity. I'm not a php4 expert, I use php5 mostly, so I'm a bit shady with the pass by reference syntax in php4, feel free to correct.
Code:
class CI_Base {

    function CI_Base()
    {
        self::instance(& $this);
    }
    
    function instance($i=null){
        static $instance;
        if($i){
            $instance = $i;
        }
        return $instance;        
    }
    
    function &get_instance()
    {
        return self::instance();
    }
}

function &get_instance(){
    return CI_Base::get_instance();
}


  Merge/overlay multiple images into a single image
Posted by: El Forum - 06-29-2007, 10:20 AM - No Replies

[eluser]Roger Glenn[/eluser]
PROBLEM
----------------
My client is selling lots in a neighborhood development. I have a map of the neighborhood with all the lots drawn out. When you mouse-over the map a larger version of each lot shape appears in green or red (along with other data) depending on it's availability.

This is okay, but it would be better if the lots on the master map were already colored red/green.

http://www.oaksofwindcrest.com/community...ble/phase1



ASSETS
----------------
I have the map in a layered Fireworks file. This is the exported GIF:

http://www.oaksofwindcrest.com/images/pl...parent.gif

I've also exported GIF's of each "lot layer" as red/green with the same dimensions and transparent backgrounds. Examples:

http://www.oaksofwindcrest.com/images/pl..._avail.gif
http://www.oaksofwindcrest.com/images/pl...3_sold.gif



ADMINISTRATION
----------------
A control panel lets the developer update lot availability and prices, so each lot's status could change at any time.



SOLUTION?
----------------
I need the system to create a new map whenever lot availability changes.

My idea is:

1. query the database for each lot's availability
2. get the appropriate red/green "lot layer" image
3. merge/overlay it on top of the master map
4. overwrite the master map image file



HELP
----------------
I found an web article on using the GD function imagecopymerge(), but is there a way to accomplish this with CodeIgniter's image manipulation library?

Does anyone have experience creating these kinds of images on the fly?


  subfolders and form validation
Posted by: El Forum - 06-29-2007, 09:49 AM - No Replies

[eluser]Unknown[/eluser]
I am working through the form validation examples and it works if I do not put the views in subfolders. Here are the statements that generate errors when used from my subfolder.

<?=$this->validation->error_string; ?>

<?=form_open('form'); ?>

Please help.

Thanks


  Installation Help Please
Posted by: El Forum - 06-29-2007, 09:23 AM - No Replies

[eluser]jozhall[/eluser]
Ok, I am brand new to these forums and I wish that my first posting would be surrounding something a bit more entertaining or enlightening. However, all I need is installation help!

I followed the installation instructions and now all I get is a CI generated 404 page when I try to access the index.php. Please remember that I know very very little about CI and was hoping to play with it a bit first before I commenting on these boards. I have doubled checked all of the installation instructions and I still can't figure out whats wrong.


  Application layout
Posted by: El Forum - 06-29-2007, 09:00 AM - No Replies

[eluser]emperius[/eluser]
I just read the wiki article http://codeigniter.com/wiki/layout_library/

and tried to do this at my application but I get a error
Fatal error: Call to a member function on a non-object in /home/worldofm/public_html/apartments/system/application/controllers/chisinau.php on line 12

When I tried to find out what's the problem I saw that load object doesn't exist in the controller

chisinau Object
(
[_ci_ob_level] =>
[_ci_view_path] =>
[_ci_is_php5] =>
[_ci_is_instance] =>
[_ci_cached_vars] => Array
(
)

[_ci_classes] => Array
(
)

[_ci_models] => Array
(
)

[_ci_helpers] => Array
(
)

[_ci_plugins] => Array
(
)

[_ci_scripts] => Array
(
)

[_ci_varmap] => Array
(
[unit_test] => unit
[user_agent] => agent
)

[_ci_scaffolding] =>
[_ci_scaff_table] =>
)

What is the problem?


  use modules in the application folder
Posted by: El Forum - 06-29-2007, 08:20 AM - No Replies

[eluser]stijn1989[/eluser]
Hi

I'm new with code igniter, but I have a question about modules. I used Zend Framework and their you could set a module structure. For example, my application structure:

http://www.pastebin.be/3404

url example: http://www.mywebsite.com/forum/topic/view/325

forum = module
topic = controller
view = action

Can I create this structure in code igniter and how do I set the controller to this structure?

Thanks


  implementing a search engine
Posted by: El Forum - 06-29-2007, 07:32 AM - No Replies

[eluser]andyd[/eluser]
Hi all CIers, i have been Rapidly developing a website for a UK store and wanted to find out if there was anyone with a 'off the shelf' search engine script.

I want to search multiple tables for a query of words and wondered if anyone can point me in the right direction.

Kind regards

Andy


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
PHP Spark not picking up ...
by kenjis
9 minutes ago
Undefined constant "CodeI...
by ozornick
Today, 12:38 AM
Docker Mastery: A Compreh...
by InsiteFX
Yesterday, 01:17 PM
How can get Response from...
by mylastof
Yesterday, 08:18 AM
DotEnv file is better loa...
by chenzen
Yesterday, 01:57 AM
How to understand entitie...
by spreaderman
06-07-2024, 09:48 PM
PHP fixes critical RCE fl...
by InsiteFX
06-07-2024, 12:01 PM
Login issue on huge traff...
by demyr
06-07-2024, 10:58 AM
How to create forgot pass...
by pratibha.cts
06-07-2024, 12:38 AM
PHP 8.3.8. This is a secu...
by InsiteFX
06-06-2024, 09:42 PM

Forum Statistics
» Members: 90,872
» Latest member: vin7777one
» Forum threads: 77,738
» Forum posts: 376,761

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB