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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 15,595
» Latest member: AmityAutoGlass
» Forum threads: 70,609
» Forum posts: 363,097

Full Statistics

Latest Threads
Language Bug
Forum: CodeIgniter 4 Support
2 hours ago
» Replies: 0   » Views: 9
Localization duplicate pa...
Forum: CodeIgniter 4 Support
6 hours ago
» Replies: 8   » Views: 298
Validate input of two pos...
Forum: General Help
6 hours ago
» Replies: 0   » Views: 47
[SOLVED] - Honeypot - How...
Forum: CodeIgniter 4 Support
6 hours ago
» Replies: 1   » Views: 41
Codeigniter 3.1.11 - Sess...
Forum: CodeIgniter 3.x
8 hours ago
» Replies: 4   » Views: 569
XSS Clean in CI4?
Forum: CodeIgniter 4 Support
8 hours ago
» Replies: 4   » Views: 110
Entity fields not saving ...
Forum: CodeIgniter 4 Support
8 hours ago
» Replies: 8   » Views: 279
not_in_list form validati...
Forum: CodeIgniter 4 Support
9 hours ago
» Replies: 1   » Views: 52
How encrypt with vector
Forum: General Help
9 hours ago
» Replies: 0   » Views: 18
generating student inform...
Forum: Installation & Setup
10 hours ago
» Replies: 1   » Views: 29

 
  Form validation and Checkboxes
Posted by: El Forum - 07-11-2007, 01:26 PM - Forum: Archived Development & Programming - Replies (3)

[eluser]Unknown[/eluser]
Hello everyone,

I'm a new user in CI, but i definitely love it!!

I used CI (form validation) with 2 checkboxes and these use the same name, different values.
The rules i applied to the checkboxes was isset|callback_checkboxes, but when i submit the form i saw that validation doesn't create the variable $this->validation->checkboxname_error.
Therefore i look into the validation class and i write these lines at line number 231:
// Build the error message
$mfield = ( ! isset($this->_fields[$field])) ? $field : $this->_fields[$field];
$message = sprintf($line, $mfield);
// Set the error variable. Example: $this->username_error
$error = $field.'_error';
$this->$error = $this->_error_prefix.$message.$this->_error_suffix;
$this->_error_array[] = $message;

Instead of these lines:
$field = ( ! isset($this->_fields[$field])) ? $field : $this->_fields[$field];
$this->_error_array[] = sprintf($line, $field);

Now the $this->validation->checkboxname_error is available.

I hope i've done something usefull.

Bye
Cristiano aka Il Viaggiatore


  form_dropdown() with set_select()
Posted by: El Forum - 07-11-2007, 12:56 PM - Forum: Archived Development & Programming - Replies (4)

[eluser]Unknown[/eluser]
I read this topic regarding using form_dropdown() with set_select(), but it doesn't seem to be working for me.

I am doing a simple Month-DD-YYYY dropdown combination to accept a person's age.

Code:
//set month array
$months=array(0=>"---------",1=>"January",2=>"February",3=>"March",4=>"April",5=>"May",6=>"June",7=>"July",8=>"August",
              9=>"September",10=>"October",11=>"November",12=>"December");
//set days array
$days=array(0=>"--");
for ($i=1;$i<=31;$i++)
    $days[$i]=$i;

//set years array            
$years=array(0=>"----");

for ($i=2007;$i>=1940;$i--){
    $years[$i]=$i;
}

so, setting dropdowns:
Code:
<p>Enter your date of Birth:</p>
<div style="float:left">Month:<br>&lt;?=form_dropdown('month',$months)?&gt;</div>
<div style="float:left">Day:<br>&lt;?=form_dropdown('day',$days)?&gt;</div>
<div style="float:left">Year:<br>&lt;?=form_dropdown('year',$years)?&gt;</div>

now for the validation set_select(), from the docs in the User's Guide, I must have access to the <OPTION> tags. I don't see how to get to those while using the form helper functions. It seems to me that I must choose one or the other.

Certainly there's a way to smoothly use these in conjunction?


  Ajax and MVC
Posted by: El Forum - 07-11-2007, 12:45 PM - Forum: Archived Development & Programming - Replies (7)

[eluser]JosGo[/eluser]
You are on a CI-screen, hit a button and through a url and posting some variables you get at a controller which uses a model and a view. A new CI-screen is built with probably the same menu and a different content. That's how mvc using CI appears to me. Schematic it's like in the attached file mvc2.png. At least that's how I see things.

When you're using Ajax you do not want an entirely new screen. You just want a part of the screen replaced by a new list of data or new details or whatever. I would like it if I could make an Ajax-call, then dependending on the Ajax-call, start a specific controller, use a model (possibly) and after that use a view. But this view should not send it's output to the user's browser but to a specified DIV. I tried to schematize this in the attached file ajaxmvc2.png. This seems the correct way to me, as it makes it possible to create an entirely Ajax-driven application and still use the MVC-approach. I took quite some time but I have still not found a way to do this. Anybody having ideas? Are extensions needed to do this? Is this not what we should want with CI? Does CI have to be rewritten for this methodology?


  How badly do we want ORM?
Posted by: El Forum - 07-11-2007, 12:32 PM - Forum: Archived Libraries & Helpers - Replies (26)

[eluser]Unknown[/eluser]
Just how badly is ORM wanted by the CI community? I have been working on a very simple helper that would "bolt on" ORM. It seems very promising, although it's a long way to alpha.

However, it does appear that the overhead of creating objects out of rows in an array is significant. I'm using lazy instantiation to avoid objectifying any particular result until directly called, but this still adds quite a bit of overhead. My initial tests show a slightly exponential increase in load times as the number of records increases. At ten records, the difference between standard array iteration and iteration with instantiation is not noticeable- in fact, sometimes with ORM proved to be faster (almost certainly due to other processes going on in the environment). At 100 records, the difference is in hundredths of a second. At 10,000 results, the difference is just under a 100% increase in load time.

The alternative is to have a function wrapper that accepts a row as input and manually generates an object. The disadvantage is that this would not be able to introspect if the result already exists, and would not be able to have a universal save() method without an extra parameter being passed to the wrapper function. However, this would allow native speeds and only instantiate where specifically needed.

After having several people look over the code (which is very bare bones at this point- it's simply a wrapper class) and trying a few techniques and methods to iterate (tail recursion, for and foreach iteration, etc.), the trend in load times seems to equal out across the board. I think the problem is simply the overhead of PHP objects (as they were sort of "bolted on" as well).

So, do you guys think it's worth continuing and creating a finished product that can be added into a project? For your uses of CI, is that an acceptable overhead?


  Getting post data from a from...
Posted by: El Forum - 07-11-2007, 11:51 AM - Forum: Archived Development & Programming - Replies (4)

[eluser]kuysal[/eluser]
Hi I'm new to CI and currently on learning level. I'm trying to make a simple login page in which, information is sent by a form with a post method and to be taken as function parameter (This is the only way I know to pass the form elements in CI). Here is the view page I'm using:

Code:
&lt;head&gt;
&lt;title&gt;&lt;?=$title?&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
<table width='848' border='0' align='center'>
  <tr>
    <td bgcolor='#E9E9E9'><table width='100%' border='0'>
      <tr>
        <td width='50%' bgcolor='#FFFFFF'><div align='center'><h1>Logo</h1></div></td>
        <td width='50%' bgcolor='#FFFFFF'>
          &lt;? echo form_open('main/login'); ?&gt;
          Username:&lt;input type='text' name='username' id="username" /&gt;
          <br />
          Password:&lt;input type='password' name='password' id="password" /&gt;
          &lt;input type='submit' name='Login' value='Login' /&gt;
        </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td bgcolor='#CCCCCC'>&nbsp;</td>
  </tr>
</table>
&lt;/body&gt;
&lt;/html&gt;

and here is my main controller which holds login function:

Code:
&lt;?php

class Main extends Controller {

    function Main()
    {
        parent::Controller();
        
        $this->load->helper('form');
        $this->load->helper('url');
    }
    
    function index()
    {        
        $data['title'] = 'My Blog Title';
        $data['heading'] = 'My Blog Heading';
        
        $this->load->view("main_index_view", $data);
    }
    
    function login($username = 'default', $password = 'default')
    {
        $login_data['title'] = 'Login Page';
        $login_data['username'] = $username;
        $login_data['password'] = $password;
        
        $this->load->view("main_login_view", $login_data);
    }
}
?&gt;

and finally that is my login view:

Code:
&lt;head&gt;
&lt;title&gt;&lt;?=$title?&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;? echo 'You are trying to log in with the username : ' . $username;
echo '<br>And password : ' . $password;
?&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;

It always displays the default parameters. Parameters sent by form can't be taken. I've checked the code many times but it still doesn't work. As I've said I'm new to CI.

Please help...


  Language translations help
Posted by: El Forum - 07-11-2007, 11:41 AM - Forum: Archived General Discussion - No Replies

[eluser]Felice Ostuni[/eluser]
Please I need
Hebrew & russian translations, if someone has already used CI with these languages please help.

I know that there is a wiki page with contributed translations, but Hebrew is not there, ans russian link is broken.


respect


  It's possible get the encrypted value using Upload class?
Posted by: El Forum - 07-11-2007, 11:36 AM - Forum: Archived Development & Programming - Replies (1)

[eluser]Unknown[/eluser]
Hi every:
I'm building a application and need some upload stuff. For this I use CI Upload Class but I have some questions about it. First take a look to this code:

Code:
$upload['encrypt_name'] = true;
$this->load->library('upload', $upload);
This generate a encrypted name for uploaded file as doc said. My problem is that with $this->upload->data() can't get this encrypted name for inserted after in the DB. Any knows if this is possible or how to solve this problem?
Cheers


  You must use the SET method to update an entry
Posted by: El Forum - 07-11-2007, 11:23 AM - Forum: Archived General Discussion - Replies (12)

[eluser]plasticated[/eluser]
I am creating a simple form to add data to my database. I have used the code demonstrated in the 20min blog tutorial as a basis. Everything was going great until I wrote the code that inserts the data. For some reason, I am getting an error telling me: 'You must use the SET method to update an entry'.

I have checked and double checked, and it's the same code used in the example. Eg:

Code:
function create_insert()
    {
        $this->db->insert('streams', $_POST);
        redirect('admin/create/');
    }

On the view page I have this:

Code:
&lt;?php echo form_open('admin/create_insert');?&gt;

<p>&lt;input type="text" name"title" /&gt;</p>
<p>&lt;input type="text" name"artist" /&gt;</p>
<p>&lt;input type="text" name"date" /&gt;</p>
<p>&lt;input type="text" name"filename" /&gt;</p>

<p>&lt;input type="submit" value="Create" /&gt;</p>

&lt;/form&gt;

Any ideas? Things were going so well up until this point! Sad


  Calendar Problems, Days Overlapping
Posted by: El Forum - 07-11-2007, 10:05 AM - Forum: Archived Development & Programming - Replies (2)

[eluser]herbageonion[/eluser]
Hi,

I'm trying to get a calendar working for a full year and then highlight the days that have entries in the database.

The problem is, the days keep overlapping into subsequent months. My code is below. Anyone have any suggestions?

Cheers,
- E

Code:
$cal_data    = array();
        
for ( $i=1; $i<13; $i++ )
{
   $like_date = ($i < 10) ? $seg_3.'-0'.$i : $seg_3 .'-'. $i;
   // Query DB
   $query    = $this->db->query("SELECT * FROM `tbl_courses` WHERE FromDate LIKE '%$like_date%'");
  
   foreach ($query->result() as $row)
   {
      $cal_day           = mdate_to_human($row->FromDate, 'd');
      $year              = mdate_to_human($row->FromDate, 'Y');
      $month             = mdate_to_human($row->FromDate, 'm');
      $day               = mdate_to_human($row->FromDate, 'd');
      $cal_data[$cal_day]= $this->config->item('site_url') .'coursedesc/index/'. $year .'/'. $month .'/'. $day.'/';
   }
   $data['calendar'][$i] = $this->calendar->generate($seg_3, $i, $cal_data);
}


  Headaing...utf8?sessions?
Posted by: El Forum - 07-11-2007, 10:01 AM - Forum: Archived Development & Programming - Replies (2)

[eluser]whidbey[/eluser]
I found it not easy to do with sessions and utf-8
my control folder with utf-8 style files.

my autoload.php use:
$autoload['libraries'] = array('database','session');
using system's session libary,
my page got error like this:

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at F:\Myshop\51szu\system\application\config\config.php:1)

Filename: libraries/Session.php

Line Number: 282


using obsession to my own libary folder.
I got errors like this:

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at F:\Myshop\51szu\system\application\config\config.php:1)

Filename: libraries/Session.php

Line Number: 452
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at F:\Myshop\51szu\system\application\config\config.php:1)

Filename: libraries/Session.php

Line Number: 493



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