Welcome Guest, Not a member yet? Register   Sign In
  Getting info from the pre_controller hook
Posted by: El Forum - 09-02-2008, 04:56 AM - Replies (3)

[eluser]FinalFrag[/eluser]
Hi there,

I have a pre_controller hook that executes the function 'example' which looks like this:

Code:
function example() {
    return 'testvar';
}

Now my question is rather simple...
How can I access the return value (in this case testvar) in my controller?

Thnx


  OFAPI + CodeIgniter
Posted by: El Forum - 09-02-2008, 03:45 AM - No Replies

[eluser]PvOostrom[/eluser]
While using OFAPI(http://code.google.com/p/ofapi/) with phpBB3 together with CodeIgniter, I ran into some annoying problems and errors.

Here is what I did:

Code:
$this->load->library('xmlrpc');
          $this->xmlrpc->set_debug(TRUE);
          $this->xmlrpc->server(site_url('forums/ofapi/ofapi.php'), 80);
          $this->xmlrpc->method('logging.login');
          $loginInfo = array('Cayren','xxxxxxx');
          $request = $loginInfo;
          //$request = array('auth' => $loginInfo);
          $this->xmlrpc->request($request);
          
          if ( ! $this->xmlrpc->send_request())
          {
             $data["response"] = $this->xmlrpc->display_error();
          }
          else
          {
             $this->xmlrpc->method('members.getMembersList');
             $request = array('auth' => $loginInfo);
             $this->xmlrpc->request($request);
             if ( ! $this->xmlrpc->send_request())
             {
                $data["response"] = $this->xmlrpc->display_error();
             }
             else
             {
                $data["response"] = $this->xmlrpc->display_response();
             }
          }

and the error I get:

Code:
Severity: Notice

Message: Undefined offset: 0

Filename: libraries/Xmlrpc.php

Line Number: 627

Fatal error: Call to a member function serialize_class() on a non-object in /usr/home/mmo/framework/libraries/Xmlrpc.php on line 646

Any idea what the problem could be?


  Validate Form Array
Posted by: El Forum - 09-02-2008, 03:08 AM - Replies (4)

[eluser]nigelb[/eluser]
Hi

I have a form field array that I want to submit to a database. Is there a way that I can use the CI validation rules on this.

Currently I am experimenting with javascript but not having much luck.

Code:
function checkuploads(form) {
    
    
    var file;
    var q;
    for (i=0; i<form.elements['partnumber[]'].length; i++)     {
        q=i+1;
        if (form.elements['partnumber[]'][i].value!= '') {
            //file += form.elements['user_files[]'][i].value;
            if (form.elements['location[]'][i].value='') {
                    alert("Enter Location in row"+q);
                    return false;
            }
            if (form.elements['qty[]'][i].value='') {
                    alert("Enter Qty in row"+q);
                    return false;
            }
    
        }
        return true;
    }
    
}


  请问验证表单时,如果输入错误,表单边框变成红色怎么做?
Posted by: El Forum - 09-02-2008, 01:26 AM - Replies (1)

[eluser]Unknown[/eluser]
请问验证表单时,如果输入错误,表单边框变成红色怎么做?

谢谢。


Edit by walesmd:

Quote:Will the verification form, if the input error, forms the border turns red how to do?
Translation provided by Google Translate, Chinese to English.

Note to all: English is the preferred language on these forums as it virtually guarantees a response within minutes. Otherwise, 99% of the community must rely on translators.


  有中国人吗?
Posted by: El Forum - 09-02-2008, 01:23 AM - Replies (1)

[eluser]Unknown[/eluser]
RT


  Exiting Controller
Posted by: El Forum - 09-02-2008, 12:56 AM - Replies (3)

[eluser]spider pig[/eluser]
I have created a form and my controller script validates it and builds an error message in the variable $errorMessage. I then test if $errorMessage is not NULL, I display the form again with an error box. I then want to exit the script:

Code:
// header displayed earlier in code
if ($errorMessage != NULL) {
    $row->al_error_message = $this->error->error_box($errorMessage);
    $this->load->view('newsletter_form', $row);
    $this->load->view('footer', $settings);
    exit;
}

However, nothing displays. Is there a way to output what is already passed to output before I exit?

Thanks


  Difference between putting a library inside /libraries and /application/libraries
Posted by: El Forum - 09-01-2008, 11:57 PM - Replies (2)

[eluser]geshan[/eluser]
What is the difference between putting a library in /libraries and /application/libraries? Which is better? Why and how?


  __construct
Posted by: El Forum - 09-01-2008, 06:36 PM - Replies (2)

[eluser]jbads[/eluser]
Do I have this right?

If I put a function call to check authentication in the construct of my class, then I do not need to include that same check on the individual functions / controllers within that class? That authentication check will run before any controllers are accessed?

Sorry for the dipshit question. Just wanna make sure my bases are covered.


  problems with ajax
Posted by: El Forum - 09-01-2008, 04:59 PM - Replies (10)

[eluser]dumbo[/eluser]
Hi, I'm new to CI as well as javascripts & AJAX. I have a noobie question about how to pass in a variable from the view's javascript and how to access it in the controller.

View's [removed]

Code:
var httpObj;
function checkName(username)
{
  httpObj = GetHttpObject();
  if(httpObj == null)
      {
          alert ("Browser does not support HTTP Request");
          return;
      }
  var url = <?php echo base_url().'index.php/addaccount/username_check';?>;
  url=url+"?q=" + username;
  url=url+"&sid;="+Math.random();
  httpObj.onreadystatechange=callback_account;
  httpObj.open("GET",url,true);
  httpObj.send(null);
}

function callback_account()
{
if (httpObj.readyState==4 || httpObj.readyState=="complete")
{
   alert(httpObj.responseText);
}
}


function GetHttpObject()
{
    var xmlHttp=null;
    try
     {
     // Firefox, Opera 8.0+, Safari
     xmlHttp=new XMLHttpRequest();
     }
    catch (e)
     {
     // Internet Explorer
     try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
     catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
     }
return xmlHttp;
}
[removed]
Controller's function:
Code:
function username_check()
   {
      echo($this->input->get('q'));
   }

So my question is can I actually pass in
Code:
"?q=" + username;
if I didn't activate query string in my config? If I can't, is there a way around this without using query strings?

My second question is how do I access that variable in controller after it's pass in?
Right now my username_check function returns blank.

Please let me know if there is anything unclear. Thanks.


  Bypassing uri-specified controller method?
Posted by: El Forum - 09-01-2008, 04:15 PM - Replies (1)

[eluser]Unknown[/eluser]
New to CI, just a quick question...
I handle user authentication in the constructor of the controller. If authentication fails, it should display the login form and not run the requested method. Without using _remap(), how can i prevent the requested method from being called automatically (from within the constructor).

Hopefully I was clear enough. Thanks


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

Username
  

Password
  





Latest Threads
Validation error messages...
by ozornick
3 hours ago
CodeIgniter4 - How i can ...
by ozornick
3 hours ago
How to Find & Hire Codeig...
by Bosborne
9 hours ago
Insert in joint table bef...
by kcs
11 hours ago
I built 30 startups in 20...
by InsiteFX
Yesterday, 11:07 PM
6 hard truths about learn...
by InsiteFX
Yesterday, 11:04 PM
4.4.1 to 4.4.8 base_url p...
by kenjis
Yesterday, 04:02 PM
CI NEEDS A PROPER DOCUMEN...
by ALTITUDE_DEV
Yesterday, 06:45 AM
Optimize.php make a probl...
by ALTITUDE_DEV
Yesterday, 06:35 AM
CodeIgniter v4.5.0 Releas...
by LP_bnss
Yesterday, 05:16 AM

Forum Statistics
» Members: 87,128
» Latest member: bolehkah71
» Forum threads: 77,631
» Forum posts: 376,297

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB