Welcome Guest, Not a member yet? Register   Sign In
  Controller name as method
Posted by: El Forum - 08-28-2007, 02:49 PM - No Replies

[eluser]zdknudsen[/eluser]
When you try to access a method with the same name as the controller (e.g. www.example.org/news/news) it shows the index method instead of a 404, even if there is no constructor.

Even more annyoingly, if you use the controllername with some of the letters capitalized as the methodname one is simply presented with a white screen.


  The URI you submitted has disallowed characters.
Posted by: El Forum - 08-28-2007, 02:47 PM - No Replies

[eluser]latuss[/eluser]
hello... I trying to post these uri

thelist2[]=some.avi
but... i get the The URI you submitted has disallowed characters....
even I replace the [] characters to nothing... to send thelist2=some.avi and I get the same error...

any ideas?

thks


  index.php remove problem
Posted by: El Forum - 08-28-2007, 01:22 PM - No Replies

[eluser]feri_soft[/eluser]
I have mod_rewrite working and all that needed but when i put the default code from the wiki:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

in my CI folder nothing happens and it remains like the default CI installation.
Can the problem be that i am using a sub directory for my CI install like

root/www/codeigniter and not root/www

And if so what should i change to the htaccess to make it work. Thank!


  Utility functions proper implementation inquiry
Posted by: El Forum - 08-28-2007, 01:11 PM - No Replies

[eluser]stevefink[/eluser]
So, I have a utility function I'd like to incorporate into my CI application. It's really simple. It's basically something which takes the ID of an object and create its respective photo directory based on what ID that object's scope is in. Some example code is like:

Code:
function account_get_data_dir ($account_id) {
    
    $dir = (int) ($account_id / 250) * 250;
    
    if ($account_id % 250 != 0) {
        
        $dir += 250;
        
    }
    
    return '/' . ($dir + 1 - 250) . '-' . $dir . '/' . $account_id;
    
}

I can easily drop this into my controller. My question is, should I? Where would you put it?

Thanks. :-) I somehow feel ... like a better man when using proper practices.

- sf


  Some kind of cache..
Posted by: El Forum - 08-28-2007, 01:09 PM - No Replies

[eluser]Unknown[/eluser]
Hello.

I have a site which uses AJAX (prototype). When I build a site page, it contains a user comments counter, this is a code to count it's value:

Code:
$query = $this -> db -> get ('table');
$counter_value = $query -> num_rows ();

$this -> load -> view ('page_with_counter');

When I made an AJAX request to store user comment in my database, I use this code:
Code:
$comment = $comment -> get ();
$this -> db -> insert ('table', $comment);

// recompute my counter value
$query = $this -> db -> get ('table');
$counter_value = $query -> num_rows ();

$this -> load -> view ('page_with_counter');

The problem is that my counter's value increases only after the second AJAX request. I dont use any CI cache, so I'm not sure this is a cache problem or not.
Please help with my problem! Smile


  Global / Generic Validation Error?
Posted by: El Forum - 08-28-2007, 12:53 PM - No Replies

[eluser]K-Fella[/eluser]
Hi,

Is there an easy way to set a global validation error - an error you can display at the top of your form if any other validation errors exist?

I ask because I have a rather long member signup form and instead of displaying all errors in one list at the top, I've set it to display seperate errors under the form elements.

But if the error message is below the page fold, people won't see it unless they scroll. I'd like to display a global error at the top of the form informing them of errors somewhere on the page.


  Smarty like templates?
Posted by: El Forum - 08-28-2007, 12:43 PM - No Replies

[eluser]feri_soft[/eluser]
How can i include one view in another much like smarty i dont want the smarty like syntax but the normal CI php based templates. I just need to have one view inside another so that i dont need to change all view for a menu item for example. Thanks!


  Extending/modifying the Profiler
Posted by: El Forum - 08-28-2007, 11:34 AM - No Replies

[eluser]LeePR[/eluser]
Hi,

I'm trying to modify the profiler class to display session data, but since CI doesn't use PHP's native sessions, I'm having problems.

My controller looks like this:

Code:
function Welcome() {
      parent::Controller();
      $this->load->library('session');    
      $this->output->enable_profiler(TRUE);
}
I added a new method called _compile_session() to the Profiler class, and made a call to it in the Profiler's run() method. Inside the Profiler's _compile_session() method, I'm trying to get session date with the following:
Code:
foreach ($this->session->userdata as $key => $val) { // Make pretty HTML; }
That gives me an error:
Code:
Severity: Notice
Message: Trying to get property of non-object
Filename: libraries/Profiler.php
Line Number: 203
How can I access the session data within the Profiler?

Thanks,
LeePR


  Ajax.Request returned html
Posted by: El Forum - 08-28-2007, 10:54 AM - No Replies

[eluser]millisami[/eluser]
The following code displays 'Login' link. When its clicked, the request is passed and the returned text is 'Hello'. Its confirmed using the Firebug's Inspect tab.

Code:
<a onclick="new Ajax.Request('/user/loginajax',{onComplete:function(request){showResponse},
method:'get', evalScripts:true}); return false;" href="#"&gt;Login</a>
Code:
function showResponse(req) {
        $('dologin')[removed] = req.responseText;
        alert('Call successful');
    }
The following is the div that should get updated with the returned 'Hello' text. But this div's content doesn't change. And the alert('Call successful') also doesn't gets called.
Code:
<div id="dologin">nothing</div>
Can you please figure out the missing in the above code?
Thanks.


  Getting current time in military time.
Posted by: El Forum - 08-28-2007, 10:54 AM - No Replies

[eluser]codelearn[/eluser]
Does anyone know how to get the current time in military time? Is there a PHP date function for that?

Thanks.


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

Username
  

Password
  





Latest Threads
hot-reload side effects s...
by InsiteFX
3 hours ago
CodeIgniter.com - Report ...
by Harry Lyre
Yesterday, 04:26 AM
Setting baseURL in Regist...
by michalsn
Yesterday, 12:09 AM
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
intermittent smtp failure...
by InsiteFX
05-11-2025, 11:30 PM
MVC vs MVCS vs CodeIgnite...
by FlavioSuar
05-10-2025, 10:33 AM
CodeIgniter Shield 1.0.0 ...
by timesprayer
05-10-2025, 05:22 AM
Website Traffic Drop Afte...
by InsiteFX
05-10-2025, 04:23 AM

Forum Statistics
» Members: 146,067
» Latest member: nohu52vnnet
» Forum threads: 78,389
» Forum posts: 379,451

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB