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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 14,069
» Latest member: jandelson
» Forum threads: 69,699
» Forum posts: 432,667

Full Statistics

Latest Threads
error in insert_batch()
Forum: General Help
38 minutes ago
» Replies: 2   » Views: 87
Tutorial Routing
Forum: General Help
6 hours ago
» Replies: 5   » Views: 131
Pagination problem, How I...
Forum: Libraries & Helpers
6 hours ago
» Replies: 2   » Views: 67
Why Codeigniter is better...
Forum: Choosing CodeIgniter
8 hours ago
» Replies: 20   » Views: 5,808
search
Forum: Model-View-Controller
Yesterday, 07:54 PM
» Replies: 1   » Views: 66
Sql Server ODBC Issue
Forum: General Help
Yesterday, 07:49 PM
» Replies: 3   » Views: 169
ChatBot reccomendation fo...
Forum: Addins
Yesterday, 07:43 PM
» Replies: 6   » Views: 154
How can I write file with...
Forum: General Help
Yesterday, 05:36 PM
» Replies: 1   » Views: 55
Window Modal does not wor...
Forum: Lounge
Yesterday, 01:50 PM
» Replies: 17   » Views: 528
How seo special title in ...
Forum: General Help
Yesterday, 11:24 AM
» Replies: 3   » Views: 77

 
  Is CI able to handle a multi-user blog?
Posted by: El Forum - 06-21-2007, 01:34 PM - Forum: Archived Development & Programming - Replies (8)

[eluser]Unknown[/eluser]
Hello,
I've looked at the authentication_lite plugin. It seems to do a good job at managing user levels but not individual users. If I wanted to create a site that allowed multiple users to submit blog entries, is CI capable of restricting users to editing/deleting only the entries they've created?

I've been using WordPress (built on PHP) for some time now but have found that I will need to seriously alter it for a future project. I was hoping that I could use something like CI to build from scratch rather than modifying WP. What do you think?


  model not loading :(
Posted by: El Forum - 06-21-2007, 01:23 PM - Forum: Archived Development & Programming - Replies (2)

[eluser]Unknown[/eluser]
Hi everyone.

I'm having a problem getting a model to load. I'm getting this error:

Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: User::$load
Filename: controllers/user.php
Line Number: 6

Fatal error: Call to a member function model() on a non-object in C:\dev\xampplite\htdocs\ci\system\application\controllers\user.php on line 6

And here is my Controller
Code:
<?php
class User extends Controller {
    
    function user()
    {
        $this->load->model('User_model');
        $this->validateLoginStatus();
    }
    ....
Any idea's on why I might be getting this error?

Thanks.
Any idea


  Integrating R&OS PDF generator in CI
Posted by: El Forum - 06-21-2007, 10:16 AM - Forum: Archived Development & Programming - Replies (3)

[eluser]andreagam[/eluser]
Hi. After a long search I decided to pick R&OS PDF generation classes and try to integrate it into CI.
I know, it's sooo far from being perfect, but being stuck to PHP4 I couldn't find anything better...

Unfortunately, I'm still a first-timer OO coder and I don't find it easy to understand the necessary steps to integrate such classes and make a CI library or what else out of it.

Does anybody want to help me and release a solution (hopefully useful to the community...)?


Well, that's what I did.
Downloaded the classes athttp://www.ros.co.nz.pdf, unzippd and I got:
- class.pdf.php
- class.ezpdf.php
- fonts folder
- readme.php (which actually calls the classes to produce the pdf file)
- data.txt (a text file with the content to be pdf'd)

I followed Danfreak advice and created a folder "my_classes" into the Application folder.
Then I put into "my_classes" the 'class' files and the fonts folder.

I added the 'ini_set' thing into the index.php file to make CI load the folder 'my_classes' (see this link).

Am I doing right till now? Well, now I took a controller 'page' and
added a function 'createpdf'.

Code:
function createpdf()
{                
require_once("class.ezpdf.php");
    $pdf =& new Cezpdf();
    $pdf->selectFont('./fonts/Helvetica.afm');
    $pdf->ezText('Hello World!',50);
    $pdf->ezStream();
}

The $pdf lines are taken from a doc example.
I get as output a text page which notifies an undefined index error.
in the class.pdf.php file, on line 1934.

Anybody willing to help me?

I'd really appreciate any help. Thanks a lot.


  warning "missing argument"
Posted by: El Forum - 06-21-2007, 10:11 AM - Forum: Archived Development & Programming - Replies (6)

[eluser]Unknown[/eluser]
hi,

i have a model with a function which has some arguments with default values like...

Code:
function doSomething($arg1, $arg2="foo") { ... }

calling that function from a controller like....

Code:
doSomething("stupid");

returns a warning message saying
Quote:Missing argument 2 for Foo_model::doSomething(), called in /path/to/file.php on line XX and defined

what i'm doing wrong?

thanks
martin


  Automated Form Generation
Posted by: El Forum - 06-21-2007, 09:53 AM - Forum: Archived Libraries & Helpers - Replies (12)

[eluser]Phil Sturgeon[/eluser]
Call me lazy but there is nothing more boring than making 100's of CRUD forms for your new admin control panel. There are a few solutions:

Scaffolding: Sadly short term solution and has its obvious flaws like cannot access NULL values and needs a separate controller for each damn table.

CodeCrafter: Is a very intelligent piece of coding, sites that code themselves are not only a dream but in some ways a nightmare... this is my job you are stealing here!! However the code is a little OTT, makes too many folders and is not the best solution.

Rapyd: Any idea how the hell to make this work? Takes me a long time of faffing just to get a simple form done, and again, includes HUNDREDS of files!

Is there any solution to simply create a really simple form from a database? Like, one single controller with a parameter accepting a table name which passes to a library to return a dynamically generated view?

There is no need for all this "Comes with 6 million Javascript libraries and requires a new folder in every single CI folder" its OTT and messy. I do hope there is another CRUD solution as coding one myself would take even longer than making the forms :p


  Fatal error: Call to a member function query() while my class extends controller
Posted by: El Forum - 06-21-2007, 09:47 AM - Forum: Archived General Discussion - Replies (3)

[eluser]Unknown[/eluser]
Hello.
I've made a class it's being loaded and everything is fine with that.
Unfortunately when I want to get access to database PHP generates me fallowing error:
Fatal error: Call to a member function query() on a non-object in D:\WWW\CodeIgniter\system\application\controllers\news.php on line 8

File looks like that:

Code:
<?php
class News extends Controller {
    function index()
    {
        $cnt='';
        $this->lang = $this->lang->user_lang;
        $this->load->database();
        $res = $this->db->query('SELECT * FROM `news` WHERE lang=\''.$this->lang.'\' ORDER BY n_timestamp');
        if($res->num_rows() > 0)
        {
            foreach($res->result_array() as $row)
            {
                $cnt = '<div id="news">
                            <div class="title">'.$row['n_title'].'</div>
                             <div class="date">'.date('H:i d.m.Y', strtotime($row['n_timestamp'])).'</div>
                             <div class="content">'.nl2br($row['n_content']).'</div>
                             </div>';
            }
        }
        $vars = array('lang' => $this->lang, 'title' => $this->get_title(), 'content' => $cnt);
        $this->page->set_vars($vars);
        $this->page->show();
    }
    function get_title()
    {
        $titles['pl'] = 'Nowosci';
        $titles['en'] = 'News';
        return $titles[$this->lang];
    }
}
?&gt;
I've figure out that the problem is in Loader.
It doesn't returns me anything and I don't know why but when it's called by Session class everything is fine. What should I do ?
edit>
Ok now i know why.
Library classes can't extend controller.
Then how to use for example view in my Lib class ?


  need help for form_helper
Posted by: El Forum - 06-21-2007, 09:17 AM - Forum: Archived Development & Programming - Replies (1)

[eluser]mr.noname[/eluser]
Hello

I'm a newbie for CI for 2 days. CI is great!

but I need help.............

How can I define rows/cols for form_textarea() by do not modify this line

Code:
$defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '90', 'rows' => '12');

in this function

Code:
function form_textarea($data = '', $value = '', $extra = '')
{
    $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '90', 'rows' => '12');
    
    $val = (( ! is_array($data) OR ! isset($data['value'])) ? $value : $data['value']);

    unset ($data['value']); // textareas don't use the value attribute
        
    return "&lt;textarea ".parse_form_attributes($data, $defaults).$extra."&gt;".$val."&lt;/textarea&gt;\n";
}

again, I'm a newbie.
Thank you.


  How integrate XAJAX in CI ??
Posted by: El Forum - 06-21-2007, 07:52 AM - Forum: Archived Development & Programming - Replies (6)

[eluser]PoWah[/eluser]
Can someone help with integrating xajax into CI ?
I found article in wiki page about that but it seems to be deprecated, because it is using init/ folder that is deprecated in CI latest versions.

So how shoul the library xajax look like?? Smile


  help with scaffolding on the tutorial
Posted by: El Forum - 06-21-2007, 06:17 AM - Forum: Archived General Discussion - Replies (1)

[eluser]adrian westlake[/eluser]
Hi,

I am new to CI, and just ran through the third tutorial (the AJAX function search) and downloaded the code. I thought I\'d try the scaffolding functionality, so amended the routes.php file, and the application.php file. When the page loads up, there is a warning message at the top.


Code:
A PHP Error was encountered

Severity: Warning

Message: preg_match() expects parameter 2 to be string, array given

Filename: helpers/url_helper.php

Line Number: 93


Anyone know the problem here?

In the routes.php file i added the line:


Code:
$route[\'scaffolding_trigger\'] = \"g6sHjjUUSF7shbH\";


In the constructor of the application.php file I put:


Code:
$this->load->scaffolding(\'functions\');


and to access the scaffolding I typed the url localhost/ci_sample/application/g6sHjjUUSF7shbH

I commented out the other code in the constuctor just in case that was interfering, but no luck...

Any help most gratefully received,

Adrian


  Need help with controller and accessing object
Posted by: El Forum - 06-21-2007, 05:56 AM - Forum: Archived Development & Programming - Replies (3)

[eluser]Robert M.[/eluser]
Hi @ all together.

This will be my first time here in the CI Forum. A have a small problem with understading how i can access an result in controller.

I got an error message like \"Trying to get property of non-object\" on line...

I want to do some like this.


Code:
function get_something($some_var){

    $this->load->model(\'some_model\',\'\',TRUE);
    $data[\'query\'] = $this->some_model->get_some_thing($some_var);
    
    if($data[\'query\']->col2==some_value){    //<--this will be the line where i get the error.
        $this->load->view(\'view_1\',$data);
    }else{
        $this->load->view(\'view_2\',$data);
    }
    

}

i know my mistake but i don\'t understand how i can access the value. normally in the view i do some like this

Code:
foreach($query as $row):
echo \"col2: \".$row->col2;

and so on but i want access the vaule in the controller

the function in some_model looks like this...

Code:
function get_some_thing($some_var){

    $this->db->select(\'col1\');
    $this->db->select(\'col2\');
    $this->db->select(\'col3\');
    $this->db->where(\'col1\',$some_var);
    
    $data = $this->db->get(\'some_table\');
    return $data->result();
}



  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.