Welcome Guest, Not a member yet? Register   Sign In
  Consistent 404 after initial success
Posted by: El Forum - 06-16-2008, 09:50 AM - Replies (10)

[eluser]Wittner[/eluser]
Hi,

I've been enjoying learing CodIgniter. Today at some stage 'though, it all seemed to fall apart. I had been succesfully using a controller, a model which got some stuff from my db and a view to show it off. So far so good. Suddenly nothing seems to be working. I've done the simplest example of a controller without success (code below)

<?php
class Names extends Controller{
function index()
{
echo "Hello World";
}
}

?>

This gives me a 404 when I browse http://localhost/blah/index.php/names/
The name of the file is names.php. It is sitting in the 'controllers' subdirectory. Initially I had this running a view but when it wouldn't work I stripped it down to the basics you see above. Please help as I was enjoying CodIgniter but now I'm getting a bit concerned as I really want to use it for my next project,

cheers,

Wittner


  problem trying to cache certian queries?
Posted by: El Forum - 06-16-2008, 09:30 AM - Replies (1)

[eluser]diez[/eluser]
ok in the database caching class it says to:
* Create a writable directory on your server where the cache files can be stored.
* Set the path to your cache folder in your application/config/database.php file.
* Enable the caching feature, either globally by setting the preference in your application/config/database.php file, or manually as described below.

so i use CI's cache folder (systems/cache) which is the default. and i enable the cache setting to the true in the db config.

however when i use these lines of code to select which queries i want to cache.
$this->db->cache_on();
$obj_query = $this->db->query($str_sql);
$this->db->cache_off();

it doesn't work....it just caches every query in my controller function being called?
i just want this one query to cached...not all of them.

if i disable the cache setting in the db config...then gets cached at all.


any help?


  SOLVED: What's wrong with my model?
Posted by: El Forum - 06-16-2008, 06:26 AM - Replies (2)

[eluser]Joakim_[/eluser]
Hello. I trying to figure out what's wrong with my model function. The function works if I replace the database stuff with a echo. It also works if I put the Active Records code directly in the Controller. Any help are very appreciated, thanks!

Code:
<?php

class Item_model extends Model {

    function Item_model()
    {
        parent::Model();
    }
    
    function get_items()
    {
        $this->db->select('*');
        $this->db->from('items');
        $this->db->where('items.id', $this->uri->segment(3));
        $this->db->join('clients', 'clients.id = items.item_client');
        return $this->db->get();
    }

}

?>

Here is the Controller

Code:
function item()
    {
        $this->load->model('item_model','model');

        $data ['query'] = $this->model->get_items();

        $this->load->view('items/item', $data);
    
    }

The view file have this php:
Code:
<?php if ($query->num_rows() > 0): ?>

<?php foreach($query->result() as $item): ?>

//Content here

<?php endforeach; ?>

<?php endif; ?>


  Inserting Multiple Records with Active Record
Posted by: El Forum - 06-16-2008, 05:56 AM - Replies (1)

[eluser]AgentPhoenix[/eluser]
Does anyone know if the AR method $this->db->insert() accepts a multi-dimensional array if I want to insert multiple rows?

Update: found out that you can't feed it a multi-dimensional array. Any ideas how I might insert a lot of rows without having to write a ton of individual arrays?


  Modular Extensions - HMVC
Posted by: El Forum - 06-16-2008, 05:45 AM - Replies (3)

[eluser]edhrx[/eluser]
Hi, I'm trying a 'hello world' to test Modular extensions for a new project.
I'm getting this message

Message: strrpos() expects parameter 1 to be string, array given

Filename: helpers/modules_helper.php

Line Number: 91

My testing structure is like this
webroot/application/modules/clients/controllers/test

my test stub is
webroot/application/controllers/base
Index has this call echo modules::run('test');


Ed..


  .htaccess (to get rid of index.php in URI) and subfolding issue (retard in the house)
Posted by: El Forum - 06-16-2008, 05:33 AM - Replies (4)

[eluser]Dagobert Renouf[/eluser]
Hi guys,

I'm sure you will enlight me within the few minutes with theses 2 simple issues, so let's do it :

1) I set up the .htacces file to get ird of index.php in the URI in my system/application folder, but it doesn't seem to do anything (I'm in localhost, could it be the problem ?).

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

2) I'm creating my admin zone and the subfolding is tricking me:
- here's my tree to access the post.php controller : \system\application\controllers\admin\blog\post.php
- here's the uri I'm using : index.php/admin/blog/post/

but i have a 404 :-(.

Hope you gurus would be able to help me out.


  Using this->lang->load to set validation error messages
Posted by: El Forum - 06-16-2008, 05:18 AM - Replies (3)

[eluser]Bramme[/eluser]
Hi all!

I'm using the validation class, works like a charm, but the site's in Dutch. So I created a dutch folder in my system/language folder and translated email_lang.php.

Next up, in my controller I do

Code:
$this->load->library('validation');
$this->lang->load('email', 'nederlands');

//set rules etc

//in my view file
<?=$this->validation->error_string?>
But the error string is still in English. Am I doing smth wrong, or is it the trick that doesn't work? Would've been handy...


  how can i change input style in Validation
Posted by: El Forum - 06-16-2008, 05:02 AM - Replies (2)

[eluser]Kotzilla[/eluser]
i make key-in form it's working fine for validation.
but i have question about how to change CSS of input ?

example if i want to make red border of input if it blank
how can i change it ? JS or CI have function to solve my problem

thank's =)


  help me database
Posted by: El Forum - 06-16-2008, 04:17 AM - No Replies

[eluser]Unknown[/eluser]
Hi All

I'm newbie

I enable store session database.
I use software Acunetix Web Vulnerability Scanner 5
I scan my site and check table ci_sessions then result 247 total row,

Please help me expaind or link tutorial.

I'm so sorry. My english not good

attach file ci_sessions then result


  .htaccess problem
Posted by: El Forum - 06-16-2008, 03:53 AM - Replies (11)

[eluser]Gaetan81[/eluser]
hello,

I recently started to use codeigniter. I must say its a great framework!

Still I have some problems with my .htaccess

Code:
RewriteEngine On

# Add www
    RewriteCond %{HTTP_HOST} ^myurl\.com$ [NC]    
    RewriteRule ^(.*)$ http://www.myurl.com/$1 [L,R=301]

# Add Trailing Slash  
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteRule ^(.*)$ http://www.myurl.com/$1/$2 [R=301,L]

    RewriteRule ^(/?)$ /index.php
    RewriteRule ^([a-z]+)(/?)$ index.php/$1

when I go to myurl.com/users/ everything just works fine. But when I add for example myurl.com/users/edit/25 he doesnt find the page.

Whats wrong to my .htaccess?

Tia


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

Username
  

Password
  





Latest Threads
Codeigniter4 version 4.5....
by kenjis
6 hours ago
SQL server connection not...
by kenjis
7 hours ago
Problem with session hand...
by kenjis
7 hours ago
Is it possible to go back...
by kenjis
7 hours ago
Cannot access protected p...
by xsPurX
8 hours ago
Update to v4.5.1, same us...
by xsPurX
Today, 08:31 AM
How to use Codeigniter wi...
by kenjis
Today, 05:06 AM
CVE-2022-40834 SQL Inject...
by kenjis
Today, 03:44 AM
Retaining search variable...
by pchriley
Today, 03:15 AM
Disable debug output in v...
by groovebird
Today, 02:26 AM

Forum Statistics
» Members: 85,395
» Latest member: bsportsto
» Forum threads: 77,581
» Forum posts: 376,007

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB