Welcome Guest, Not a member yet? Register   Sign In
  pass multiple data arrays to view?
Posted by: El Forum - 02-15-2008, 07:09 AM - Replies (8)

[eluser]jorre[/eluser]
I pass data to a view, the normal way:

Code:
$this->load->view('poll_show',$data);

now that works great, but I also want to pass some additional data to that view, that is not in $data.

Can I pass $data2 also to that same view?


  jquery with forms
Posted by: El Forum - 02-15-2008, 07:05 AM - Replies (11)

[eluser]A.M.F[/eluser]
hello

i tried to work with jquery and forms combining with CI but i couldn't get it work... i am still a newbie in jquery so i tried to searc for good toturials, but all i found was scripts...

what i want to do is to send a form through jquery and work with the data with CI.

thank u!


  opening error
Posted by: El Forum - 02-15-2008, 06:53 AM - Replies (4)

[eluser]Bharani[/eluser]
http://snrt1/CodeIgniter/index.php/image...ller/index


in a image_Gallery_controller file..

i did code every correctly..but form not display..it showing this error



404 Page Not Found

The page you requested was not found.


  I can't get a simple foreach loop going here!
Posted by: El Forum - 02-15-2008, 05:40 AM - Replies (10)

[eluser]patbert[/eluser]
I am going to apologize up front for this. I know this is a simple one but it has me totally stumped. I have seen other posts relating to this on here but I can't seem to apply the solutions to my problem.

I have:

Code:
$this->db->select('*')->from('blog_posts')->order_by('post_date');
$query = $this->db->get();
$this->load->view('blogindex', $query);
in my controller. . .
Code:
<?php foreach($query as $row): ?>
    <div class="news_title">&lt;?php $row['post_date']; ?&gt;&nbsp;&lt;?php $row['post_title']; ?&gt;</div>
    <p class="news_text">&lt;?php $row['post_data']; ?&gt;</p>
&lt;?php endforeach; ?&gt;
in my view.

I have tried changing $query to $query->result_array() in either the load view line (#3) or the foreach part of the view itself. No go.

Some nice person on irc got me a bit farther. They suggested I do:
Code:
$this->db->select('*')->from('blog_posts')->order_by('post_date');
$query = $this->db->get();
$data['results'] = $query->result_array();
$this->load->view('blogindex', $data);
and then &lt;?php foreach($results as $row): ?&gt; in my view. That does not return any errors! But it does not return any of the results, either! It seems to loop twice, but doesn't fill anything in.

If instead of using the view, I put
Code:
if ($query->num_rows() > 0) {
            foreach ($query->result() as $row) {
                echo $row->post_id;
                echo $row->post_title;
                echo $row->post_data;
                echo $row->post_date;
                echo $row->post_fa_user_id;
                echo $row->post_hidden;
            }
        }
in my controller, the query does return results, so I know the query is good and there are results to be displayed.


So that is where I am right now, I've created a bit of a mess, no?

Thank you for any help!


  i got this error
Posted by: El Forum - 02-15-2008, 05:35 AM - Replies (3)

[eluser]Bharani[/eluser]

Code:
&lt;?php
class photo_gallery_controller extends Controller {

  function index()
  {  
    parent::Controller();

    # loaders
    
    $this->load->library('validation');
    $this->load->helper(array('form', 'url', 'array'));
    $this->load->library('image_lib');
    $this->load->database();
    
    
        $config['upload_path'] = './uploads/'; // added
        $config['allowed_types'] = 'gif|jpg|png'; // added
        $config['max_size']    = '100'; // added
        $config['max_width']  = '1024'; // added
        $config['max_height']  = '768'; // added
        $this->image_lib->clear();
        $this->image_lib->initialize($config);
        $this->load->library('upload',$config); // changed
        $this->upload->do_upload();

        $rules['albumname'] = "required";
        $rules['description'] = "required";
        $this->validation->set_rules($rules);
        
        #Input and textarea field attributes
        $data['albumname'] = array('name' => 'albumname', 'id' => 'albumname','size' => '15');
        $data['description'] = array('name' => 'description', 'id' => 'description','rows' => 3, 'cols' => 25);
        $data['keyword'] = array('name' => 'keyword', 'id' => 'keyword');
        $data['userfile'] = array('name' => 'userfile', 'id' => 'image');
        
  
        if ($this->validation->run() == FALSE)
        {
            $this->load->view('photo_gallery_view', $data);
        }
        else
        {
        
        $albumname = $this->input->post('albumname');
        $description = $this->input->post('description');
        $comments = $this->input->post('keyword');
        $userfile = $this->input->post('userfile');
        $this->load->view('formsuccess');
        $this->load->model('photo_gallery_model','', TRUE);
        $this->photo_gallery_model->add_album($this->upload->data());
        //header("location:../photo_gallery_view.php");    
        //redirect('photo_gallery_view/');
        
         redirect('/photo_gallery_controller/', 'location');
    
    }
    
function album_getall(){
$this->load->model('photo_gallery_model');
$data['query']=$this->photo_gallery_model->album_getall();
$this->load->view('photo_gallery_view',$data);
}
    
    
  }

i am trying after i have inster the page must be redirect to insert form





this error i got










A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\Xampp\xampp\htdocs\CodeIgniter\system\application\controllers\photo_gallery_controller.php:75)

Filename: helpers/url_helper.php

Line Number: 487


  display values
Posted by: El Forum - 02-15-2008, 05:09 AM - Replies (2)

[eluser]Bharani[/eluser]
dear friend..

i am inserting albumname ,description,and image,

and also i success fully inserted the values..

now i want to view the values what i have inserted ..tell mw how can i do ...


  DB error after CI 1.6.1 upgrade
Posted by: El Forum - 02-15-2008, 04:03 AM - Replies (6)

[eluser]Lockzi[/eluser]
Hello,

after upgrading to CodeIgniter 1.6.1, I keep on getting this error message

Quote:Fatal error: Call to a member function order_by() on a non-object in C:\wamp\www\system\application\models\ss_model.php on line 32

Here's my model code (little stripped)

Code:
class Ss_model extends Model
{
    
    function Ss_model()
    {
        // Overloading with constructor
        parent::Model();
    }

    function retriveRecent($offset, $limit = 30)
    {
        
        $this->db->order_by("date", "desc");  
        
        if (is_numeric($offset))
            $this->db->offset($offset);
        if (is_numeric($limit))
            $this->db->limit($limit);
        
        if (!is_numeric($limit) && !is_numeric($offset))
        {
            $count = $this->db->get('news');
            return $count->result_array();
        }
        else
        {
            return $this->db->get('news');
        }
    }
}


Line 32 is this one
Code:
$this->db->order_by("date", "desc");


I have activated activerecord in the database.php file.

Cheers, Lockzi


  [RESOLVED] Table library question: cell/column width / library hack
Posted by: El Forum - 02-15-2008, 03:58 AM - Replies (8)

[eluser]Laszlo Breda[/eluser]
This is my first, so I must start with saying that CI is a really great framework and hats off the developers and community! I'm porting our company's site to CI now and even though we need some light CMS functionality, I'm much more comfortable working with CI than fighting with CMS sw for our non-CMS static and php stuff. Only other candidate was/is MODx.

Okay, on to the question:
I've been using the html table class and it's been great except I was unable to specify the column width individually. I hacked the library so now it's working fine, setting the width is painless. Of course, with the new version out, I had to carry over the hack.

1. Any official way to set the width that I haven't noticed?
2. Or is it possible to make these hacks upgrade-safe? Perhaps with the new extension (MY_) feature?

Thanks,
Laszlo


  initialize the Forge class
Posted by: El Forum - 02-15-2008, 03:56 AM - No Replies

[eluser]chejnik[/eluser]
Hello, I have probably very simple question, sorry.

How can I initialize the Forge class. According to user guide my database driver should be running.
Before I load forge class, I make few queries, so I guess that my driver is running. Is that true?

this function from model view

Code:
function create_UniqueUserStructure($user, $structure)
    {
         $this->load->dbforge();
    
    $this->dbforge->add_field('id');
    foreach($structure as $row) {
        
        $helper = $row['databaseRowName'];
        switch ($row['inputName']) {
        case 'VARCHAR':
            $fields[$helper] ['type']=$row['inputName'];
            $fields[$helper] ['constraint']=$row['inputLenght'];
            break;
        case 'TEXT':
            $fields[$helper] ['type']=$row['inputName'];
            break;
        case 'TINYINT':
            $fields[$helper] ['type']=$row['inputName'];
            $fields[$helper] ['constraint']=$row['inputLenght'];
            break;
        }
        
    
    }
    
        $this->dbforge->add_field($fields);
    $table_name='ds_'.$user;
    $this->dbforge->create_table($table_name, TRUE);

   }

Thank you. Ales


  alternative name for controller using routes
Posted by: El Forum - 02-15-2008, 03:31 AM - Replies (9)

[eluser]gRoberts[/eluser]
Hi all,

I've nearly finished a web site i've been working on for 3 months now (THANK GOD) and the client has requested that I rename two controllers.

Code:
$route['default_controller'] = "home";
$route['scaffolding_trigger'] = "";

$route['signin'] = '/user/login';
$route['signout'] = '/user/logout';
$route['signup'] = '/user/signup';
$route['contact'] = '/home/contact';
$route['about'] = '/home/about';
$route['faq'] = '/home/faq';
$route['terms'] = '/home/terms';
$route['privacy'] = '/home/privacy';
$route['invite'] = '/my/friends/invite';
$route['sitemap'] = '/home/sitemap';

$route['(blog|categories|collectors|csv|ebay|external|home|items|my|tags|tools|user|groups)(.+)?'] = '$1$2';

$route[':any'] = "user/view/$1";

Here are the routes I currently have setup. This works great.

Now i'd like to add an route which will forward all requests from one controller to another. This way, things dont get messy.

I have tried adding

Code:
$route['blogs/:any'] = '/blog/$1';
$route['collectibles/:any'] = '/items/$1';

But that gives me an 404 when I try using the new name.

I then tried

Code:
$route['blogs(.+)?'] = '/blog$1';
$route['collectibles(.+)?'] = '/items$1';

Which worked but didn't pass any of my parameters to my functions.

Does anyone have any idea why?

Thank you all in advance!


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

Username
  

Password
  





Latest Threads
Array to HTML "Table"
by paulkd
8 hours ago
TypeError when trying to ...
by b126
9 hours ago
Webhooks and WebSockets
by InsiteFX
Yesterday, 10:39 AM
Retaining search variable...
by pchriley
Yesterday, 05:46 AM
Reading a session variabl...
by xanabobana
Yesterday, 05:05 AM
Update to v4.5.1, same us...
by kenjis
04-17-2024, 07:47 PM
Codeigniter 4 extend core...
by Semsion
04-17-2024, 05:08 AM
v4.5.1 Bug Fix Released
by lokman
04-16-2024, 02:12 PM
problem with textarea
by Nitin Arora
04-16-2024, 05:07 AM
Showing pdf on browser
by aarefi
04-16-2024, 04:38 AM

Forum Statistics
» Members: 84,571
» Latest member: gachoivncom
» Forum threads: 77,558
» Forum posts: 375,896

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB