Welcome Guest, Not a member yet? Register   Sign In
  How to remove GET parameters to avoid a 404?
Posted by: El Forum - 09-06-2007, 12:41 AM - No Replies

[eluser]mipa[/eluser]
Hi,

We're migrating our old site to CodeIgniter and are using the Redirect directive in Apache to handle the redirects to our new pages. Our QA just discovered that the Redirect directive will add all the old links' GET parameters to the new CI urls and cause the new CI links to die a nasty 404 death.

So, the question is: what's the best way to chop the GET parameters before CI chokes? Should I use a hook? Are there any suggested or tested / proven solutions to this problem?

Any help is appreciated!


  Coffee Levels critical!!! Cannot function anymore...
Posted by: El Forum - 09-05-2007, 08:47 PM - No Replies

[eluser]CI Lee[/eluser]
Hey all,

Simple problem, tired eyes....


function

Code:
//$filedata = $this->upload->data();
$data['file_name'] = $data['file_name'];
$file_name = $data['file_name'];
$user_id = $this->session->userdata('id');
                    
// update profile
$sql = "UPDATE profile SET file_name = $file_name WHERE user_id = $user_id LIMIT 1";
$query  = $this->db->query($sql);

Error
Code:
Error Number: 1109

Unknown table '67bfa84ce291b67e0c85322e4b2ee20f' in field list

UPDATE profile SET file_name = 67bfa84ce291b67e0c85322e4b2ee20f.jpg WHERE user_id = 5 LIMIT 1


Someone with fresh eyes wanna point out what is wrong? It is not updating at all however "file_name" exists in the db and the user id is correct...


  Disallawed characters in a form
Posted by: El Forum - 09-05-2007, 05:32 PM - No Replies

[eluser]miguelp[/eluser]
hi, i've build a form using the from Helper, it displays ok and it works fine until a submit that form.
i've changes the input library and added a $str to the exit function so i can see what are the characters ( exit('Disallowed Key Characters: '. $str); ).
every time i submit the form it says: Disallowed Key Characters: Array
and i cant figure out why, it all seems to be ok.
here's the form code:

Code:
<div id="arch">
    <div id="holder">
&lt;?php
// constroi array de anos
$actual = date('Y');
$anos = array();
for($i=0;$i<10;$i++){
    
    $anos[$i] = $actual +$i;    
}

//constroi array cidades
$towns=array();
for($e=0;$e<count($cidades);$e++){
    $towns[$cidades[$e]['id']] = $cidades[$e]['nome'];
}

//constroi array tipo de cliente
$ctipo=array();
for($i=0;$i<count($tipocliente);$i++){
    $ctipo[$tipocliente[$i]['id']] = $tipocliente[$i]['tipo'];
}
//constroi array categorias
$categorias=array();

for($i=0;$i<count($cats);$i++){
    $categorias[$cats[$i]['id']] = $cats[$i]['Catnome'];
}

$data = Array(
                1 => array(
                              'name'        => 'codigo_cliente',
                              'id'          => 'codigo_cliente',
                              'maxlength'   => '100',
                              'size'        => '50',
                              'style'       => 'width:50%'
                              ),
                 2 => array('name'        => 'nome',
                              'id'          => 'nome',
                              'maxlength'   => '100',
                              'size'        => '50',
                              'style'       => 'width:50%'),
                              
                 3 => array('name'        => 'idade',
                              'id'          => 'idade',
                              'maxlength'   => '100',
                              'size'        => '50',
                              'style'       => 'width:50%'),
                              
                 4 => array('name'        => 'email',
                              'id'          => 'email',
                              'maxlength'   => '100',
                              'size'        => '50',
                              'style'       => 'width:50%'),
                              
                 5 => array('name'        => 'telefone',
                              'id'          => 'telefone',
                              'maxlength'   => '100',
                              'size'        => '50',
                              'style'       => 'width:50%'),
                              
                 6 => array('name'        => 'description',
                              'id'          => 'description',
                              'rows'        => '15',
                              'cols'        => '100',
                              'style'       => 'width:100%'),
                              
                 7 => array('name'        => 'dia',
                              'id'          => 'dia',
                              'maxlength'   => '2',
                              'size'        => '3'),
                              
                 8 => array(
                              'name'        => 'active',
                              'id'          => 'active',
                              'value'       => '1',
                              'checked'     => TRUE,
                              'style'       => 'margin:10px')
);
                              
$meses = array('01'=>'Janeiro',
                '02'=>'Fevereiro',
                '03'=>'Mar&ccedil;o',
                '04'=>'Abril',
                '05'=>'Maio',
                '06'=>'Junho',
                '07'=>'Julho',
                '08'=>'Agosto',
                '09'=>'Setembro',
                '10'=>'Outubro',
                '11'=>'Novembro',
                '12'=>'Dezembro');
                
    echo form_open('admin/insert_client');
        echo "c&oacute;digo cliente: <br />".form_input($data[1]."<br />");
        echo "nome: <br />".form_input($data[2]."<br />");
        echo "idade: <br />".form_input($data[3]."<br />");
        echo "email: <br />".form_input($data[4]."<br />");
        echo "telefone: <br />".form_input($data[5]."<br />");
        echo "descri&ccedil;&atilde;o: <br />". form_textarea($data[6])."<br />";
        echo "validade: <br />". form_input($data[7]) ." ". form_dropdown('mes', $meses, '01') ." ". form_dropdown('ano', $anos, $actual) ."<br />";
        echo "tpo de cliente: <br />". form_dropdown('ctipo', $ctipo, '01') ."<br />";
        echo "categoria: <br />". form_dropdown('cat_id', $categorias, '01') ."<br />";
        echo "cidade: <br />". form_dropdown('cid_id', $towns, '01') ."<br />";
        echo "activo: ". form_checkbox('active','active',TRUE) ."<br />";
        echo form_submit('submit', 'Submit Post');
        echo "&lt;/form&gt;"; //form_close();

?&gt;
</div></div>

can you tell me whats wrong?
thanks in advance


  How do I sort database results using multiple columns?
Posted by: El Forum - 09-05-2007, 04:26 PM - No Replies

[eluser]danfloun[/eluser]
As the question states, how can I order by first second and third column ascending.

At present I use

Code:
$this->db->select('id, company, first_name, last_name, landline_tel, mobile_tel, fax_tel, email');
        $this->db->orderby("company", "asc");
        $query = $this->db->get('clients');
        return $query->result();

but this only orders by the company column and I would like to order by the last_name column as a second sort.

Thanks

Danny


  Another authorization issue...
Posted by: El Forum - 09-05-2007, 03:12 PM - No Replies

[eluser]Unknown[/eluser]
Hello All,
Maybe it is simple issue but I have been fighting with this for a long time.

I want to develop application with user authorization.
Where shall I put check permissions and auhtorization functions ? In model, hooks or controllers ?

First I built separate controller called "Users" but I don't how to call this controller in other controllers ? (In every controller to check if your are logged in or not , if not it will send you to login view)

Another approach is to built in model but then I can't load views directly from model.

I am wondering what is your approach to this issue. I don't want to use any external classes and want to write it bymyself.

Regards
bastek


  Question : Best practice - PHP code in javascript
Posted by: El Forum - 09-05-2007, 03:09 PM - No Replies

[eluser]Crafter[/eluser]
I generally place my javascript functions in directories off my top level directory, as in

-> system
-> application
-> images
-> js


Recently, my web applications have been using more and more intelligent processing. For example, where previously my javascript was mainly to achieve form validation and clever browser tricks, nowadays, what with Ajax and all, I am moving more and more of my traditional view code into JavaScript.

So, it is therefore not uncommon to see URLS and other application paths in my JavaScript code.

However, with the code existing off my application directories, there is no opportunities to inject PHP code like base_url() into them.

What innovate ways do others solve this issue.


  Depth of controllers directory limited?
Posted by: El Forum - 09-05-2007, 02:49 PM - No Replies

[eluser]Unknown[/eluser]
Hello all!
this is my first post here.
I am using CI to develop a college management system.
So far all the problems I encountered have been solved when i went throug the forums
but this one problem is left over

is the depth of the controllers directory limited?
I have controllers structure like this

Quote:faculty/
-------some controllers
-------managefaculty/
--------------------addfaculty.php
student/
--------some controllers


Now if i link to http://localhost/faculty/managefaculty/addFaculty.html
it doesn't work, but if i put the same controller in /faculty/ and link
as
http://localhost/faculty/addFaculty.html
it works fine.

I just want to organize all the controllers in folders. But I am not able to.

thanks! sid


  Ajax CI Buffering error. Please help!
Posted by: El Forum - 09-05-2007, 02:43 PM - No Replies

[eluser]kruse[/eluser]
Hello,

I am developing a small CI based application.
In this application I am using a normal for that is sending the form data via Ajax
to the database and then displaying a message saying that the data was updated.

On my local PC everything works perfectly fine but on my public webserver I get an error
message after posting the form, even though the function works fine and the database is updated with the form data.

The message I get is:

Code:
Fatal error: ob_start(): Cannot use output buffering in output buffering display handlers in /var/www/web8/html/system/libraries/Exceptions.php on line 161

The strange thing is that it does not seem to appear on IE6 only Firefox.

I am using the brilliant Ajax for Code Igniter library and the latest CI 1.5.4 and PHP 5.2.

Please help me, I have struggled with this error for hours and hours.

Kind Regards,
Daniel


  array helper, element function - returns false on empty
Posted by: El Forum - 09-05-2007, 01:53 PM - No Replies

[eluser]Unknown[/eluser]
Hi all,

This isn't necessarily a "bug", but rather something I think is being done incorrectly.

In the array_helper.php file, the function element(...) returns FALSE on two conditions:
1. The array element is not set.
2. The array element is set but is empty.

I think #2 should be returned as '' (empty) rather than as FALSE. The reason is that sometimes, an array element is purposely set to be empty, like:

Code:
$name['first'] = 'John';
$name['middle'] = '';
$name['last'] = 'Doe';

So we purposely set middle to be '' and not FALSE. By returning FALSE, we are not describing the array element accurately!

Therefore, my proposed fix is simply:
- On line 44 of array_helper.php, change:
Code:
if ( ! isset($array[$item]) OR $array[$item] == "")
to:
Code:
if ( ! isset($array[$item]))


Michael Huynh


  working with multiple models/classes
Posted by: El Forum - 09-05-2007, 12:15 PM - No Replies

[eluser]Jon L[/eluser]
hey all, I have a question regarding models/libraries.

I'm working on developing a Forum, while hoping to reuse models that I create for other purposes, such as Blogs.

I'm using a modified version of the Nested Sets model that was posted in the forums by Thunder. the class extended Model, so when I developed a "Categories" model and a "Posts" model, they each extended the Nested Sets model.

I'm changing the implementation now, so that the Nested Sets class is included as a library instead of a model. Nested set now does not extend anything, it's just an established class that uses the $CI instance (get_instance)
To customize how categories/posts are returned, I'm developing a "Forums" model that will interface with both the "Categories" and "Posts" models

My dilemma is this. Due to my code changes:
Categories_model extends Model (and uses $this->load->library to load the nested set class)
Posts_model extends Model (and uses $this->load->library to load the nested set class)
Forums_model extends Model (and uses $this->load->model twice, to load both Categories and Posts)

Will I have any conflicts with loading the nested set library twice?
Additionally, is there a better way to implement this? I do feel nested set should definitely be a library, so I think I'm right there, but then how I'm implementing Forums_model to use Posts_model and Categories_model seems it might post some problems, so I figured I'd post here before going further

Can anyone provide me any assistance on this issue?

Many thanks!


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

Username
  

Password
  





Latest Threads
Any user guid or video o...
by msnisha
1 hour ago
MVC vs MVCS vs CodeIgnite...
by massimiliano1.mancini
5 hours ago
Why PHP is still worth le...
by php_rocs
10 hours ago
Is hiring a digital marke...
by Markhenry123
Today, 02:45 AM
my controller fails to fi...
by PaulC
Today, 01:40 AM
My Library cannot see ses...
by InsiteFX
Yesterday, 08:48 PM
update the framework to t...
by captain-sensible
Yesterday, 12:14 PM
CodeIgniter Shield 1.0.0 ...
by Ayatorvi
Yesterday, 06:06 AM
Update to 4.6.1
by serialkiller
05-07-2025, 11:58 AM
Can't create new database...
by paulbalandan
05-07-2025, 08:49 AM

Forum Statistics
» Members: 144,976
» Latest member: bangalorerussian
» Forum threads: 78,382
» Forum posts: 379,420

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB