Welcome Guest, Not a member yet? Register   Sign In
  Validation Errors not showing
Posted by: El Forum - 11-28-2008, 10:43 AM - Replies (1)

[eluser]Aidy[/eluser]
Hello,

I have put a bit of code together following the guide on form validation. The problem I am having is any form error messages from validation_errors(); are not showing.

Here is the code for the controller.

Code:
class Player extends Controller {

    function Player()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->load->view('player');
    }
    
    function signup()
    {
        $this->load->helper(array('form', 'url'));
        
        $this->load->library('form_validation');
        
        $this->form_validation->set_rules('first_name', 'First Name', 'required');
                
        if ($this->form_validation->run() == FALSE)
        {
            $this->load->view('player/signup');
        }
        else
        {
            $this->load->view('formsuccess');
        }
    }
}

And here is the code for the view 'player/signup'

Code:
<?php echo validation_errors(); ?>

<?php echo form_open('player/signup'); ?>

<fieldset>

<legend>Personal Details</legend>

<p>
  <label for="first_name">First Name</label>
  &lt;input type="text" maxlength="30" name="first_name" value="&lt;?php echo set_value('first_name'); ?&gt;"/&gt;
</p>

<p>
  <label for="middle_name">Middle Name</label>
  &lt;input type="text" maxlength="30" name="middle_name"/&gt;
</p>

<p>
  <label for="last_name">Last Name</label>
  &lt;input type="text" maxlength="30" name="last_name"/&gt;
</p>

Can anyone point out how I am going wrong?

Cheers!


  call a controller function from another controller
Posted by: El Forum - 11-28-2008, 10:43 AM - Replies (3)

[eluser]datguru[/eluser]
Hi there,

Just wondering if it is possible to call a controller function from another controller.. so for example say I have Controller 1 that has a function called function 1 and then I have controller 2. I want to be able to access function1 of controller 1 from controller 2. Is that possible? the reason I want to do this is because I have a generic function that I want a few controllers to use.

Thanks


  function error
Posted by: El Forum - 11-28-2008, 09:54 AM - Replies (2)

[eluser]Unknown[/eluser]
I am just start with codeigniter 1 day ago
and i create a blog page like the user guide told me

&lt;?php
class Blog extends Controller {

function index()
{
echo 'Hello World!';
}

function com()
{
echo 'Hello World2222222222222!';
}
}
?&gt;

and put the right code on the config file

but only the function index is loading
when i am trying to load the com function its show me the index
i am us this url: http://mydomain.com/blog/com

anyone can help me?

thanks.


  Grouping results in CodeIgniter
Posted by: El Forum - 11-28-2008, 09:17 AM - No Replies

[eluser]Unknown[/eluser]
I have a file upload element (downloads table) to a CodeIgniter site I'm working on (my first site built using the framework) and I need to group the files by the id of a second table (developements table). So that the desired output would be:

<h3>Some Name 1</h3>
<p>Some document about something.<br />
<a href="download_1.pdf">download_1.pdf</a></p>
<p>Some document about something more.<br />
<a href="download_3.pdf">download_3.pdf</a></p>

<h3>Some Name 2</h3>
<p>Some document about something else.<br />
<a href="download_2.pdf">download_2.pdf</a></p>

This is what the tables look like:

Table 1: downloads table

Code:
id     development_id     summary     file_name     date_created
20     78     Some document about something.     download_1.pdf     2008-11-27 10:35:40
21     77     Some document about something else.     download_2.pdf     2008-11-27 10:36:07
22     78     Some document about something more.     download_3.pdf     2008-11-28 10:33:55

Table 2: developments
Code:
id     development_name     project_desc     investor_id     file_name
78     Some Name 1     Some desc. Some desc. Some desc....     0     image_1.jpg
77     Some Name 2     Some desc. Some desc. Some desc....     0     image_2.jpg

And here's my current model code:

Code:
$this->db->select('downloads.id, development_id, summary, downloads.file_name, developments.id, development_name');
$this->db->join('developments', 'downloads.development_id = developments.id');
$this->db->order_by('developments.id', 'desc');
$query = $this->db->get('downloads');
return $query;

Can anyone advise on the best way to achieve this in CodeIginter?

Many thanks.


  Multi form question
Posted by: El Forum - 11-28-2008, 08:45 AM - Replies (2)

[eluser]tim1965[/eluser]
Hi i have a newbie question (which i know is very simple and maybe i having a stupido day, not again !!!)
So i have a multi form registration process, that will store the data for each form in a table as the form is submitted (temp tables until all data is captured), before caling the next form in the process.
I want to keep seperate controllers for each form (for validation and insert) if possible. My first form is correclty set up and i can validate and insert the data. So my stupido question is how do i call the next controller to process form 2 ?
I cannot use $this>load. Should i be calling an uri from my controller 1 to call my controller 2 ?
Many thnaks for your help.


  form validation : not quite finished
Posted by: El Forum - 11-28-2008, 08:36 AM - Replies (1)

[eluser]soupdragon[/eluser]
Am I the only one who thinks that the new form validation is not really finished ?

For example great idea i can have my rules in a seperate config file such
array(
'field' => 'username',
'label' => 'lang:username',
'rules' => 'required'
),

So i have actually defined the label - but can i use it in the form itself ?
seems to be no that is only for the error messages ?

Also there is the repopulating the form
i should do this set_value('field name')

okay nps BUT in my controller i am having to remember to use $this->input->post(''field name'); because in the controller set value does not work.

Is it just me or does anyone else think the same ?


  Fatal error: Cannot redeclare class ci_exceptions
Posted by: El Forum - 11-28-2008, 07:31 AM - Replies (6)

[eluser]Andreas Vandenbussche[/eluser]
Hi,

I'm setting up a CI site, it's my first one I ever did using a framework and I have to say, it's waaaaay more fun than creating everything yourself.
My problem is: I made a site and put it on my (php5) server and everything worked, today I was moving it to the server where it should be (php4..) but I got an error..
Of course I first googled it but nothing seems to help..
I put everything back to how it was in the beginning, so I hope you can help me?
The biggest problem is that I didn't design this site on my own, someone else started it but due to stuff he hasn't got the time anymore so I took it from him..

the error I'm getting is

Code:
Fatal error: Cannot redeclare class ci_exceptions in /home/beachsho/public_html/nieuw/system/libraries/Exceptions.php on line 27

The site is at this location at the moment..

Thanks in advance for the help and thanks for the magnificent framework

(I'm sorry if I put it in the wrong area but it's my first post here...)

Greets from Brave Little Belgium


  Validation errors not showing
Posted by: El Forum - 11-28-2008, 06:53 AM - Replies (4)

[eluser]fandelost[/eluser]
Hi, I'm using the Validation class from CI 1.7, everything's working fine on the production site, but on the online version, it won't show any error messages.

The routes are fine and I can log into the script if I provide the right credentials. I tried changing the uri_protocol values in the config file with no success.

I don't post the script because it's a pretty simple one, but I will if needed.
Has anyone stumbled upon a similar problem? Any ideas? I just don't know where to start looking for the error. Thanks!

EDIT: I've realized the online version won't let me login at all (using the right credentials) and it definitely doesn't pass $this->validation->run()


  CI ver 1.7 problem,anyone can help me?
Posted by: El Forum - 11-28-2008, 06:46 AM - No Replies

[eluser]chmod[/eluser]
I use CI 1.6.1 at last three months.Now I use CI 1.7,and the problem is remaining which is CI's session problem.

When I change config.php like this:

Code:
$config['sess_cookie_name']        = 'ci_session';
$config['sess_expiration']        = 10;
$config['sess_encrypt_cookie']    = FALSE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']        = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']     = 5;

and I want to use CI's db-session to login,and when session expired timeout OR CLOSE THE BROWSER,I want the user redirect to login page.
Using name and password login,and then I have logined.but I refresh the browser,I found that: each fresh bind each new sesion_id.
and the new session_id has been regenerated and saved in table.

When I closed the browser and wait for 10s,and I access last page.I found new session_id has regenerated but not need to login .


Controller: mycenter.php

Code:
&lt;?php

class Mycenter extends Controller{
    function Mycenter(){
        parent::Controller();
        $this->lang->load('title','english');
        $this->lang->load('table','english');
        $this->lang->load('error','english');
        $this->lang->load('notice','english');
        $this->load->model('common/security/security_model');
    }

    function index(){
        $isloginto = $this->security_model->isLoginTo();
        if ($isloginto === true){
            $data = array('title' => $this->lang->line('title_mycenter_index'));
            $this->load->view('center/mycenter_tpl',$data);
        }else{
            $forward = $this->session->set_userdata('forward',$_SERVER['PHP_SELF']);
            redirect('center/loginto','refresh');
        }
    }
}
?&gt;

ModelConfusedecurity_model.php

Code:
&lt;?php

class Security_model extends Model{
    function Security_model(){
        parent::Model();
    }

    function sessionIdIsInTable($id){
        $this->db->where('session_id',$id);
        $this->db->from('ci_sessions');
        $query = $this->db->get();
        if($query->num_rows() > 0){
            return true;
        }else{
            return false;
        }
    }

    function isLoginto(){
        $session_id = $this->session->userdata('session_id');
        if ( isset($session_id) ){
            if ($this->sessionIdIsInTable($session_id)){
                return true;
            }else{
                return false;
            }
        }else{
            return false;
        }
    }

}
?&gt;

the CI 1.7 user doc said:
Note: The Session class has built-in garbage collection which clears out expired sessions so you do not need to write your own routine to do it.


But I found the session_id which has expired not be removed by ci.Why?

Is any wrong with me ? when the browser close, the session_id was still being the ci_sessions table.
how can I make a user to login?


  .htaccess 301 Redirect + RedirectMatch + get strings + will someone think of the children?
Posted by: El Forum - 11-28-2008, 05:06 AM - Replies (2)

[eluser]HdotNET[/eluser]
Hi there,

I am redeveloping an ancient Joomla website. Its done, all that is left to do is old url redirection. Fun fun fun.

There's a mixture of urls in the old site, some use GET query strings and some utilise .htaccess and Joomla-ness to serve content.

All the /slashed/urls/ without a get string work fine in the redirect.

Any url with a GET string leads to the CI message "The URI you submitted has disallowed characters.".... suggesting the redirect is not working with query strings. Putting die(print_r($_SERVER)) at the head of the index.php confirms this.

What is the correct way to redirect from a get query string to a /normal/url/ using mod_rewrite.

Anyone? Bueller?

H

Code:
#
# http://domain.com > http://www.domain.com conversion
#
Options +FollowSymlinks
RewriteEngine on



#
# straight url redirections from the old site
#
Redirect    301    /component/option,com_remository/Itemid,26/        http://www.domain.com/archive/
Redirect    301    /component/option,com_remository/Itemid,26/        http://www.domain.com/archive/
Redirect    301    /component/option,com_contact/Itemid,37/        http://www.domain.com/contact_us/
Redirect    301    /content/view/11/30/    http://www.domain.com/guidelines_for_authors/
Redirect    301    /content/view/10/29/    http://www.domain.com/why_publish/
Redirect    301    /index.php?option=com_remository&Itemid=26&func=search&parent=category&filecatid=0    http://www.domain.com/search/
Redirect    301    /component/option,com_reginterest/Itemid,32/    http://www.domain.com/registration_form/
Redirect    301    /content/view/20/40/    http://www.domain.com/links/


#
# dynamic url redirections from the old site
#
#downloads
RedirectMatch     301     /downloads(.*) /assets/file/beep/downloads$1
#tags
RedirectMatch     301     /index.php?option=com_remository&func=tag&tag_id=13&Itemid=43    http://www.domain.com/archive/subject/$1/
#folders
RedirectMatch     301     /index.php?option=com_remository&Itemid;=(.*)&func=selectfolder&filecatid;=(.*)    /archive/issue/$2/



## code igniter from now on.
# rewrite code from here
# http://ellislab.com/codeigniter/user-guide/general/urls.html
RewriteCond $1 !^(index\.php|favicon\.ico|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]


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

Username
  

Password
  





Latest Threads
Getting supportedLocales ...
by kcs
4 hours ago
Codeigniter Shield Bannin...
by xsPurX
6 hours ago
Best way to create micros...
by InsiteFX
10 hours ago
Component help
by FlashMaster
Today, 01:41 AM
Show logo in email inbox
by WiParson
Today, 12:48 AM
Limiting Stack Trace Erro...
by byrallier
Yesterday, 02:21 PM
Bug with sessions CI 4.5....
by ALTITUDE_DEV
Yesterday, 01:36 PM
codeigniter 3.0.1 equiped...
by JustJohnQ
Yesterday, 10:05 AM
Display a custom error if...
by b126
Yesterday, 06:22 AM
Type error in SYSTEMPATH\...
by DXArc
Yesterday, 06:20 AM

Forum Statistics
» Members: 85,222
» Latest member: southcoastele
» Forum threads: 77,575
» Forum posts: 375,964

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB