Welcome Guest, Not a member yet? Register   Sign In
  Oversight in xmlrpcs causes huge memory usage
Posted by: El Forum - 10-23-2007, 02:55 AM - Replies (7)

[eluser]chriskl[/eluser]
In the XMLRPC server library, a debug check is missing on this line:

$plist .= "$i - " . print_r(get_object_vars($parser_object->xh[$parser]['params'][$i]), TRUE). ";\n";

This causes it to unnecessarily build up gigantic strings during very large XMLRPC requests. It's necessary to change it to:

if ($this->debug === TRUE)
{
$plist .= "$i - " . print_r(get_object_vars($parser_object->xh[$parser]['params'][$i]), TRUE). ";\n";
}

Cheers,

Chris


  Problem with sending form data by Query string
Posted by: El Forum - 10-23-2007, 02:32 AM - Replies (3)

[eluser]Unknown[/eluser]
Hi,

I have form which is having one text field, named by CompanyName. when I submit the form it submitting as query string (form method is GET )as i want. The following is sample URL for that : http://localhost/index.php/Companysearch...me=Darwish

I'm trying to get CompanyName within my result function as follows:

Code:
function result(){
  if(isset($_GET['CompanyName'])){
    $comName = $_GET['CompanyName'];
  }
  echo $comName;
}

My problem is that, it says $comName is undefined variable. Is there any wrong in my code?.
or can't we use like above?

Please guide me how to sort out this

Nisal


  Able to access global variable, but ...
Posted by: El Forum - 10-22-2007, 08:24 PM - Replies (7)

[eluser]cinewbie81[/eluser]
Hi all,

I have a helper file named : "setting_helper.php" as following:

Code:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

define("__VARIABLE1__","variable1");
$var2 = "variable2";
?>

The following is my controller class:

Code:
<?php
class Main extends Controller {

    function Main()
    {    
        parent::Controller();
          $this->load->helper(array('url', 'setting'));
    }

    function Runsetup()
    {
             gloabl $var2;
             echo __VARIABLE1__;
             echo $var2;
        }
}
?>

How come when i call Runsetup function, echo __VARIABLE1__ will print me "variable1", but echo $var2 will give me nothing ?? By right it should return me the value "variable2" as i already decraed it as global variable .. anyone ??


  Recipe for mixed segments/querystring
Posted by: El Forum - 10-22-2007, 07:31 PM - Replies (4)

[eluser]edoornav[/eluser]
Hi,

I'd like to be able to use mixed segments/querystrings in my urls like this:

http://mydomain.com/mycontroller/mymetho...bar=param3

I've read all of the relevant threads discussing how this might be done, tried many combinations of config values and rewrite rules and still don't seem to be able to get it to work. Does anyone have a simple recipe to reliably get this to work. I would really be grateful.

~ryan


  Call a controller only if form submitted - disallow manual entry of URI
Posted by: El Forum - 10-22-2007, 04:44 PM - Replies (6)

[eluser]jahboite[/eluser]
If I'm using a controller that is supposed to be called only upon submission of a form, how do I ensure that if the URI is typed into the browser address bar, the controller is not called?

I've worked around this issue, by submitting a hidden field with the form and then, in the controller, I check if isset and redirect to the default controller if it isn't
(if it is, I unset it because I'm using: $this->db->insert('table_name',$_POST) ).

This make sense? Is there a CI inbuilt way to do this that doesn't remove the URI functionality for controllers that I would allow to be called from the address bar?

Does anyone have any suggestions for better ways to do this?


  Menus across multiple views
Posted by: El Forum - 10-22-2007, 03:35 PM - Replies (1)

[eluser]kevinprince[/eluser]
Hi,
Im building a database based application where pretty much everything being shown in dynamically created.

I have a set of menus which are pulled from the database (lists of kinds of content etc).

Is there a way of making it so these menus can be put in the own class as I dont want to be writing the query in every class i need the menu to appear in.


  Multiple templates, loading default variables for main template?
Posted by: El Forum - 10-22-2007, 02:41 PM - Replies (3)

[eluser]fancms[/eluser]
Currently I have it set up like so:

- template is the main template that wraps around the content. it contains a variable to echo the content passed by the controller
- in the controller I have it set up so that
$data = all the template variables I need to load for that controller

Code:
$template['content'] = $this->parser->parse('controllertemplatename', $data, true); #calls the parser

- finally, the call to output the whole page:
Code:
$this->parser->parse('maintemplatename', $template);

My problem is that the main template has tags (ie {lang_something}), and those tags are of course not going to get output properly because the $template variable doesn't hold the array for it. I could copy/paste the array with the needed variables but then I'd need to do it for every controller which would make upgrading that menu a nightmare.

Do I need to create a controller for the main template? Is there a way to load the array of variables without copy/pasting it over and over? Am I overlooking something completely obvious? (Wouldn't be the first time Wink)


  Custom error message by field name
Posted by: El Forum - 10-22-2007, 01:49 PM - No Replies

[eluser]mkhairul[/eluser]
Hi all!

I'm quite new to CI. I'd like to know if there's a better way to create a custom error message for a specific field for a certain rule?

For example, I have 3 field test1, test2, test3. I want required rule error message for test1 to be woot, test2 to be wargh and test3 to be something else.


I did a few modifications the Validation library(copied it to the application/library folder and modified it there).

Code:
function set_custom_message($lang, $field_name, $val = '')
{
  $this->custom_error_message[$lang][$field_name] = $val;
}

And modified the run function a little bit
Code:
// Did the rule test negatively?  If so, grab the error.
if ($result === FALSE)
{
    if(array_key_exists($rule, $this->custom_error_message))
    {
        $custom_error = $this->custom_error_message[$rule];
        if(array_key_exists($field, $custom_error))
        {
            $line = $custom_error[$field];
        }
    }else{
        if ( ! isset($this->_error_messages[$rule]))
        {
            if (FALSE === ($line = $this->CI->lang->line($rule)))
            {
                $line = 'Unable to access an error message corresponding to your field name.';
            }
        }
        else
        {
            $line = $this->_error_messages[$rule];;
        }
    }

    // Build the error message
    $mfield = ( ! isset($this->_fields[$field])) ? $field : $this->_fields[$field];
    $mparam = ( ! isset($this->_fields[$param])) ? $param : $this->_fields[$param];
    $message = sprintf($line, $mfield, $mparam);

    // Set the error variable.  Example: $this->username_error
    $error = $field.'_error';
    $this->$error = $this->_error_prefix.$message.$this->_error_suffix;

    // Add the error to the error array
    $this->_error_array[] = $message;
    continue 2;
}


  errror Result()
Posted by: El Forum - 10-22-2007, 01:24 PM - Replies (8)

[eluser]MMCCQQ[/eluser]
Fatal error: Call to a member function result() on a non-object in /home/tunerspo/public_html/application/views/spot_side.php on line 8


why???

spot_side.php

Code:
<div id="wrap_contx">
    <div id="sidebar">
        <div id="t_in">Photos of This Spot</div>
        <div id="div_details">
    Add Photos
    </div
&lt;?php foreach($query->result() as $row):?&gt;

<img src="&lt;?=$row->thumb;?&gt;">


  &lt;?php endforeach;?&gt;
  </div>
  </div>

Code:
function GetGallerySpot()
    {
        
        
        $this->db->where('id_spot',$this->uri->segment(3));
        $query = $this->db->get('gallery');
        
        if($query->num_rows > 0 )
        {
            
            return $query;
            
        }
        else
        {
            
            return FALSE;
            
        }


  oracle problem? 'ocifetchinto() expects parameter 1 to be resource, null given' ?
Posted by: El Forum - 10-22-2007, 12:40 PM - Replies (4)

[eluser]Unknown[/eluser]
Hi, everyone. :-)

Here I am, long time reader, first time poster, asking for your kind help with this rare problem.

After a week pulling my hair out, I've finally made the oci8 library work with PHP 5.2.4. As I have the Oracle 8i Client 8.1.7.0.0, I had to download the Oracle 10g Instant Client, reconfigure my path variable, edit my registry malformed NLS_LANG variable, etc. (more info here: http://tinyurl.com/34nzlt, http://tinyurl.com/enrtj and here http://tinyurl.com/2a9wo4).

Now I've been able to query a table from my oracle DB directrly through a PHP script:

Code:
$db_conn = ocilogon("user", "passwd", 'SID');

    $cmdstr = "select * from user_tables";

    $parsed = ociparse($db_conn, $cmdstr);
    ociexecute($parsed);

    $nrows = ocifetchstatement($parsed, $results);

    for ($i = 0; $i < $nrows; $i++ )
    {
      echo $results["TABLE_NAME"][$i];
      echo number_format($results["TABLESPACE_NAME"][$i],   2);
    }

But when I try to do a similar thing throu codeigniter, I get this output:

A PHP Error was encountered
Severity: Warning
Message: ocifetchinto() expects parameter 1 to be resource, null given
Filename: oci8/oci8_result.php
Line Number: 159

Any idea what could it mean? I'm thinking, some kind of incompatibility between the 8.1 and 9i version of my DB.

my config\database.php look like this:
Code:
$db['default']['hostname'] = "SID";
$db['default']['username'] = "user";
$db['default']['password'] = "passwd";
$db['default']['database'] = "";
$db['default']['dbdriver'] = "oci8";
$db['default']['dbprefix'] = "";
$db['default']['active_r'] = TRUE;
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";

and my model:

Code:
class Ora extends Model {
    function Ora()
    {   parent::Model();
        $this->load->database('default',TRUE);    }

    function get_sel()
    {   $query = $this->db->getwhere('month',array('month >' => '06'));
        return $query->result();}
}

after the ifrst error, it repeats this one several times:

A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$nombre_mes
Filename: libraries/Loader.php(647) : eval()'d code
Line Number: 11

Now, the interesting thing is that it repeats this second error the same number of times as rows it should have returned, so as far as I can tell, it's getting the result; it just can't show it.

any ideas? thanks!


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

Username
  

Password
  





Latest Threads
Changing Session cookie -...
by codeus
2 hours ago
hot-reload side effects s...
by PaulC
Today, 02:44 AM
using app/Config/App.php ...
by sam547
Yesterday, 03:04 PM
Setting baseURL in Regist...
by grimpirate
05-15-2025, 02:20 PM
CRUD Code Generator
by DeanE10
05-15-2025, 05:31 AM
CodeIgniter.com - Report ...
by Harry Lyre
05-14-2025, 04:26 AM
Missing closing bracket w...
by abf
05-13-2025, 07:27 PM
Update from 4.6.0 to 4.6....
by FlavioSuar
05-13-2025, 04:17 AM
Sessions old files are de...
by InsiteFX
05-12-2025, 10:30 PM
Ajax post failing with Ty...
by PaulC
05-12-2025, 12:23 AM

Forum Statistics
» Members: 146,570
» Latest member: lilacblosom
» Forum threads: 78,392
» Forum posts: 379,465

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB