Search Results

Search found 981 results on 40 pages for 'codeigniter 2'.

Page 18/40 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • CodeIgniter subfolders and URI routing

    - by shummel7845
    I’ve read the manual on URI routing and views and something is not clicking with me. In my views folder, I have a subfolder called products. In there is a file called product_view. In my controller, I have: function index() { $data['title'] = 'Product Overview'; $data['main_content'] = 'products/product_view'; $this->load->view('templates/main.php', $data); } The template loads a header view, a footer view and a navigation view, plus the view as a main content variable. In my URI routing, I have: $route['products/product-overview'] = 'products/product_view']; This causes a 404 error when I try to go to domain.com/products/product-overview. Do I need to do something with my .htaccess? If so, what? Here is my .htaccess: Options +FollowSymLinks Options -Indexes DirectoryIndex index.php RewriteEngine on RewriteCond $1 !^(index\.php|resources|images|css|js|robots\.txt|favicon\.ico) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L,QSA] I’d appreciate some specific help, as the documentation isn’t specific on how to address this. I’ve done a little searching in the forums, and didn’t see anything, but I’m posting this while I keep looking.

    Read the article

  • codeigniter and JSON

    - by ole
    Hello all i having a problem that it only get 1 value in my database and its my title and i want to show content and username from the same table to. here is my JSON kode <script type="text/javascript"> $.getJSON( 'ajax/forumThreads', function(data) { alert(data[0].overskrift); alert(data[0].indhold); } ); </script> my controller <?php class ajax extends Controller { function forumThreads() { $this->load->model('ajax_model'); $data['forum_list'] = $this->ajax_model->forumList(); if ($data['forum_list'] !== false) { echo json_encode($data['forum_list']); } } } my model fle <?php class ajax_model extends Model { function forumList() { $this->db->select('overskrift', 'indhold', 'brugernavn', 'dato'); $this->db->order_by('id', 'desc'); $this->db->limit(5); $forum_list = $this->db->get('forum_traad'); if($forum_list->num_rows() > 0) { return $forum_list->result_array(); } else { return false; } } }

    Read the article

  • Add Form In Every Row with table helper Codeigniter

    - by wibi
    Hi i am creating table using table helper, but in every row i want to add form, in html like this : <table> <form action=""> <tr> <td><input type="text" name="name2"></td> </tr> </form> <form action=""> <tr> <td><input type="text" name="name2"></td> </tr> </form> </table> But i want in table helper: I have tried this one: $this->table->add_row( form_open('myAction'). form_input('name'.$i), form_submit('Submit') form_close() ); And I use firebugs to inspect element produces, like this: <table> <tr> <form action="myAction"> <td><input type="text" name="name1"></td> </form> <td><input type="submit"></td> </tr> </table> why tag doesn't show at the last tag , but show at the first tag . Thanks

    Read the article

  • Codeigniter : database configuration

    - by nppCods
    I am beginner for CI so don’t have good knowledge. My problem is: I am not using any database. All the records are fetched from JSON. Therefore I don’t think I need to configure database… As said by CI, it doesn’t necessarily ask for database. So my database.php configuration is : $active_group = ‘default’; $active_record = FALSE; $db[‘default’][‘hostname’] = ‘’; $db[‘default’][‘username’] = ‘’; $db[‘default’][‘password’] = ‘’; $db[‘default’][‘database’] = ‘’; $db[‘default’][‘dbdriver’] = ‘mysql’; $db[‘default’][‘dbprefix’] = ‘’; $db[‘default’][‘pconnect’] = TRUE; $db[‘default’][‘db_debug’] = TRUE; $db[‘default’][‘cache_on’] = FALSE; $db[‘default’][‘cachedir’] = ‘’; $db[‘default’][‘char_set’] = ‘utf8’; $db[‘default’][‘dbcollat’] = ‘utf8_general_ci’; $db[‘default’][‘swap_pre’] = ‘’; $db[‘default’][‘autoinit’] = TRUE; $db[‘default’][‘stricton’] = FALSE; It works in my local system but doesn’t work in live server. I am so surprised. Then I provided hostname, username, password and dbdriver, it works. My question is that, is that necessary to provide all the details if I am not using database? Thank you for your suggestion.

    Read the article

  • Displaying Data from a Join in Codeigniter

    - by Brad
    I am using a simple join to pull data from two databases. This is the join in the model function com_control(){ $this->db->select('*'); $this->db->from('comments'); $this->db->join('posts', 'comments.entry_id = posts.id'); $query = $this->db->get(); return $query->result; } My desired method of display is going to be in a table so I am starting out to use like this foreach($comm_control as $row){ $this->table->add_row( $row->entry_id, $row->comments.id, $row->comment, $row->title ); }//end of foreach My problem is the display of data from comments.id. What is the proper format to add the comment.id into the table rows? I need the ID from both tables for display, edit and delete further on in the table. The only display I get at this time for "comment.id" is the word id. The Any help would be appreciated.

    Read the article

  • update in codeigniter works but displays an error message

    - by Charmie
    i was just wondering what could be the problem with a working code yet displays an error message such as this: A PHP Error was encountered Severity: Notice Message: Array to string conversion Filename: database/DB_active_rec.php Line Number: 1407 im trying to update fields in my database. I have this code and every tutorial are just the same for batch upload. It works anyway but the thing is it display such an error. this what i have in my model: function update2($data){ $this->db->update_batch('users',$data, "id"); } This what i have in my controller: public function updateValues(){ $this->load->model('get_db'); $newRow = array( array( 'id' => '3', 'firstname' => 'Rapphie' ), array( 'id' => '2', 'firstname' => 'Charmie' ) ); $this->get_db->update2($newRow); echo "it has been updated"; } please help.

    Read the article

  • get value from database based on array in codeigniter

    - by Developer
    I have an array $user = array([0]=>1 [1]=>2 [2]=>3) which contains id's of certain users. I need to get the countries of these users from database. foreach($userid as $user){ $this->db->select('country'); $this->db->where('user_id',$user); $this->db->from('company'); $usercountry = $this->db->get(); $count = $usercountry->row(); $country = $count->country; } Suppose user1 has country ES, user2 has IN, user3 has US, user4 has UK. then if array contains 1,2,3. Then i need to get the countries ES,IN,US.

    Read the article

  • Codeigniter: Using data in a controller

    - by Kevin Brown
    I'm new to php and CI, and I'm having some trouble in my controller. I feel that I'm doing this the wrong way, and it could be easier, I just don't know the syntax: $data['members'] = $this->home_model->getUser($id); $credit = $this->home_model->getCredit($id); if ($credit == '0'){stuff...} So I'm getting the user's data that has their the same information as "getCredit" does, but I don't know how to get the single variable that I need for my if statement... How can I just use the "getUser" function so that I'm not pulling redundant information?

    Read the article

  • Codeigniter Active record help

    - by sea_1987
    Hello, I am trying to increment a INT column by 1 if a certain field is not null on an update request, currently I have this update too columns, public function updateCronDetails($transaction_reference, $flag, $log) { $data = array ( 'flag' => $flag, 'log' => "$log" ); $this->db->where('transaction_reference', $transaction_reference); $this->db->update('sy_cron', $data); } What I need to know is how I can check if the value being sent to the log field is NULL and if it is how could I increment a column called count by 1?

    Read the article

  • empty() doesn't work with codeigniter input class

    - by BabyAzerty
    This is really weird. Whenever I call something like if(empty($this->input->post("foo")){//blabla} The whole PHP is "down" and I get a blank page from the website (even when I don't pass through this empty(input) line). I know this is not the right method and it is stupid, I change the code to if(!$this->input->post("foo")){//blabla} Better I guess ? Seriously, how come the empty(input) breaks down the entire PHP page ? (I can't get any echo "something").

    Read the article

  • Restful client on Codeigniter issue

    - by user1852837
    This is weird. I don't know what is problem on my website. My website works on local server but not on live server. Login page works on first signin but after logout then re-login again message says: "invalid username and password" since it works on first attempt. I found out when I debugging that http://xxxxx.com/api/authentication/sign not found. It display 404 page not found. Sometimes you can login and sometimes not. In my local it works. I contact the web server admin and I ask what is the status of the session on the server and How does it execute it's web requests? (Sockets, file_get_contents, curl?). They said that No problems reproduced with Server Sessions and PHP Curl works fine. I know it's weird but can somebody here can figure it out what is the problem behind of it.

    Read the article

  • Learning to program styles? [closed]

    - by MrNewbProgrammer
    I'm a beginner programmer and I am currently developing an application of my own, just for the fun of it and learning to program. I'm building it from scratch, because I think that in this way I will learn the most. I have stumbled upon MVC's and CMS, CodeIgniter really got my attention, and the basic use is very straight forward. But I do not understand the inner workings completely. So I have decided that it might be better to just develop from scratch and maybe return to codeIgniter later, was that good decision? Would it be better to use CodeIgniter and learn from that?

    Read the article

  • What Technology to use to Interact with Codeigniter "Backend" [on hold]

    - by symlynk
    I am building an application that looks like this: Codeingiter App/MySQL DB <--> API (this is the "contract" between the two entities) <--> Web Frontend I want the web frontend to be able to interact with the MySQL DB by requesting JSON objects in a RESTful way. But I don't want the Web Frontend to expose the workings of the Codeigniter App (i.e. let the Web Frontend clients see the domain of the codeigniter app, including its controllers/functions). The Codeigniter App is for business clients, and needs to be "hidden" from the Web Frontend users. I want to use PHP or Javascript, and am considering node js's Express, Angular, and SLIM PHP. Any thoughts as to what technology would suit this purpose best? Thanks

    Read the article

  • Internal Server Error issue with Codeigniter. Cant open linked page

    - by Adam Perlis
    Hi I am VERY new to backend development. I am trying to setup a User Registration using Codeigniter. I have gotten pretty far but for some reason I can get the "Create Account button working. I have my site up and running on t-mrkt.com/mycisite would you guys mind taking a look and seeing where I might be going wrong? Here is a link to my files: https://www.dropbox.com/sh/z54j4qd50yf3t0p/MnnghGBB_D Thanks for your help! Adam

    Read the article

  • only removing index.php rule works on my NginX and CodeIgniter as rewrite. Why?

    - by Atomei Cosmin
    I am very new in rewriting in nginx but although I've spent 2 days reading on forums, I still can't get some Codeigniter rewrites working ... server { listen *:80; server_name artademy.com www.artademy.com; root /var/www/artademy.com/web; index index.html index.htm index.php index.cgi index.pl index.xhtml; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?/$1; } if (!-e $request_filename) { rewrite ^/(index.php\?)/(.*)$ /$1/mobile_app last; break; } error_log /var/log/ispconfig/httpd/artademy.com/error.log; access_log /var/log/ispconfig/httpd/artademy.com/access.log combined; ## Disable .htaccess and other hidden files location ~ /\. { deny all; access_log off; log_not_found off; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location /stats { index index.html index.php; auth_basic "Members Only"; auth_basic_user_file /var/www/clients/client0/web3/.htpasswd_stats; } location ^~ /awstats-icon { alias /usr/share/awstats/icon; } location ~ \.php$ { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9012; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_intercept_errors on; } } Codeigniter settings are: well for uri_protocol: REQUEST_URI; What i noticed is that from this rule: rewrite ^/(.)$ /index.php?/$1; it works ever if i write it like this: rewrite ^/(.)$ /index.php?; It might be a wild guess but it stops at the question mark... Anyhow what I need are rules as these from .htaccess: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{QUERY_STRING} ^lang=([a-z]{2})$ RewriteRule ^([a-z]{2})$ index.php?/home_page?lang=$1 [L,QSA] RewriteRule ^([a-z]{2})$ index.php?/home_page?lang=$1 [L,QSA] #how_it_works RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^how-it-works/(en)$ index.php?/how_it_works?lang=en [L,QSA] #order_status RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^order-status/(en)$ index.php?/order_status?lang=en [L,QSA] Can anyone tell me what i'm doing wrong and show me a proper way for at least one rule? It would be more than helpful. Thank you in advance! ^^ PS: I made it work on apache by using Path_info for uri_protocol.. if this info is of any help, and i remember having kind of the same problem there too but switching to path_info made it all good.

    Read the article

  • How can I use htaccess to protect a subdirectory of codeigniter installation?

    - by Art Peterson
    I have codeigniter installed at the root directory, and would like to have a subdirectory called "test" password protected using htaccess. I keep getting a "404 page not found" no matter what I try. The directory structure is: /public_html /css /images /system (codeigniter directory) /test .htaccess .htaccess .htpasswd index.php The root .htaccess file looks like: RewriteEngine On RewriteBase / Options -Indexes # Removes trailing slashes RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ $1 [L,R=301] # Enforce www RewriteCond %{HTTP_HOST} !^(www) [NC] RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301] #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^(.*)test(.*) RewriteRule ^(.*)$ index.php?/$1 [L] The /test/.htaccess file: AuthUserFile /home/dir/.htpasswd AuthName "Protected Area" AuthType Basic <limit GET POST PUT> require user adminuser </limit> I'm not even getting the authentication prompt, just the codeigniter 404 page when I navigate to the url "http://www.mydomain.com/test/". Please advise!

    Read the article

  • CodeIgniter's XSS Protection is removing <script> tags from user inputs... but I don't want it to!

    - by Jack W-H
    Hey folks, CodeIgniter is brilliant but I'm using it to develop a site where users need to be able to share their code for websites. Unfortunately, CodeIgniter has been doing the "right" thing by removing <script> tags from my user's inputs into the database, so when it's returned data looks like this: [removed] User's data [removed] However, I need my site to DISPLAY script tags but obviously not PARSE them. How can I get CodeIgniter or PHP to return <script> tags, but still sanitise them for the database and return them without them executing? Thanks! Jack EDIT: By the way, it's not an option to use stuff like Markdown, everything has to output to copy-pastable code that could work with no modification somewhere else

    Read the article

  • Codeigniter ignoring query strings. Only loading index page.

    - by Keyo
    I have setup remote debugging in netbeans. It works except codeigniter only loads the default controller (home page). I have enabled query strings with $config['enable_query_strings'] = TRUE; The debugger opens up a page with the following url http://blinkfilms.ben.dev/myid/tests?XDEBUG_SESSION_START=netbeans-xdebug So codeigniter should fire up the controller in controllers/myid/tests.php

    Read the article

  • Codeigniter: How to build an edit form that uses form validation and re-population?

    - by Sergio
    Hi There, I have a simple form in codeigniter that I wish to use for the editing or records. I am at the stage where my form is displayed and the values entered into the corresponding input boxes. This is done by simply setting the values of said boxes to whatever they need to be in the view: <input type="text" value="<?php echo $article['short_desc'];?>" name="short_desc" /> But, if I wish to use form_validation in codeigniter then I have to add thos code to my mark-up: <input value="<?php echo set_value('short_desc')?>" type="text" name="short_desc" /> So not the value can be set with the set_value function should it need to be repopulated on error from the post data. Is there a way to combine the two so that my edit form can show the values to be edited but also re-populate? Thanks

    Read the article

  • Multiple Mod_ReWrites on one site - Possible? (Wordpress blog in root directory, CodeIgniter project

    - by Sootah
    Currently I am creating a project with CodeIgniter that is contained within a subdirectory of my domain. For this example we'll call it domain.com/test. I also have Wordpress installed on this domain, and all of its files are in the root. For instance, if you navigate to my domain.com then it pulls up the Wordpress blog. I currently have the Wordpress mod_rewrite activated so that it uses friendly-URLs. For those of you that aren't familiar with CodeIgniter, all requests are routed through index.php in the project's root folder. So, in this case, it'd be domain.com/text/index.php. A request to the application would be sent like domain.com/test/index.php/somecontroller/method. What I'd like to do, is for any incoming request that is directed towards the /test/ folder, or some subdirectory therein I'd like it to appropriately rewrite the URL so the index.php isn't included. (As per the example above, it'd end up being domain.com/test/somecontroller/method) For any OTHER request, meaning anything that's not within the /test/ directory, I would like it to route the request to Wordpress. I would imagine it's a simple RewriteCond to make it check to see if the request is for the /test/ directory or a subdirectory therein, but I've no idea how to do it. Perhaps you can't have more than one set of Rewrite Rules per site. I will include the recommended mod_rewrite rules for each application. Wordpress: (Currently used) <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> CodeIgniter: (Pulled from their Wiki) <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / #Removes access to the system folder by users. #Additionally this will allow you to create a System.php controller, #previously this would not have been possible. #'system' can be replaced if you have renamed your system folder. RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] #When your application folder isn't in the system folder #This snippet prevents user access to the application folder #Submitted by: Fabdrol #Rename 'application' to your applications folder name. RewriteCond %{REQUEST_URI} ^application.* RewriteRule ^(.*)$ /index.php?/$1 [L] #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] </IfModule> <IfModule !mod_rewrite.c> # If we don't have mod_rewrite installed, all 404's # can be sent to index.php, and everything works as normal. # Submitted by: ElliotHaughin ErrorDocument 404 /index.php </IfModule> Any and all help is much appreciated!! Thanks, -Sootah

    Read the article

  • Codeigniter Image Library Cropping an Image with 2 sets of coordinates to make square anywhere?

    - by chris
    Spending time reading through the docs, and searching for examples. I understand cropping an image from top 0, and left 0 is pretty straight forward. However. I would like to pass 2 sets of coordinates, a starting point and an ending point. Four Points, a Square that is defined anywhere. However from the examples I am finding, and from what I gather the rendition is not going to let me do this. codeigniter so I am seeking confirmation on this thought, is it true that I can only provide end points from 0, and it crops a square based on said end points or can I actually specify an x start, an x end, and similar for y? Or is there some other technique I can use within codeigniter that will allow me to pass for coordinates for starting and ending points?

    Read the article

  • how to create Codeigniter route that doesn't override the other controller routes?

    - by bakazero
    I've got a lot controller in my Codeigniter apps, ex: Signup, Profile, Main, etc.. Now I want to build "User" controller. what I want: if people goes to url: example.com/signup, I want use default route to "Signup" Controller if people goes to url: example.com/bobby.ariffin, I want to reroute this to "User" Controller because the url not handled by any Controller in my apps. I had create this in my config/routes.php: $route['(:any)'] = "user/$1"; but it's override all the route in my apps to "User" Controller. Is there any simple route for Codeigniter that doesn't override the other controller routes?

    Read the article

  • Codeigniter Open Source Applications for Coding References

    - by Hafizul Amri
    I choose codeigniter to be my first framework to work with. Now I'm looking for open source applications built based on this framework to be my references for good coding practices and standards. From my previous experiences in application development, it was hard for me to maintain, upgrade, or modify existing applications due to my bad coding practices. Do you have any suggestion of application based on codeigniter framework for me to be referred? So that it can help me to write better coding by referring to their good and maybe best coding pratices. Thank you!

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >