Exporters From Japan
Wholesale exporters from Japan   Company Established 1983
CARVIEW
Select Language

My sessions that are database backed sometimes randomly expire and I lose the data in the session. I am using Code Igniter 1.7.3

]]> Is it possible to use $this->load->view(‘abc’) from within a custom class?? tag:codeigniter.com,2011:forums/viewthread/.193622 2011-07-08T10:00:07Z Codeigniter Hey all my first post on here and have used Codeigniter a bit in the past so hope I am not being a dumb-ass but here is my query.

I would like to make my controllers cleaner in terms of code by creating custom classes for common methods/functions that I call within them. For instance having an if statement within every controller that checks if a user is logged in could be done on a single line as a method call to a custom class.

So instead of this as a controller…

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

class 
Members_only extends CI_Controller {
    
    
public function index() 
    
{    
        
if($this->some_class->is_logged_in())
        
{
            $this
->load->view('welcome_message');
        
}
        
else
        
{
            redirect
('authentication/admin');
        
}
    }

I would rather do this as a controller…

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

class 
Members_only extends CI_Controller {
    
    
public function index() 
    
{    
        
        $this
->some_class->is_logged_in('welcome_message''authentication/admin');
        
        
    
}

You can see I would like to pass the page names as parameters to my custom classes method, it is within this method that I would then like to load the view but it would seem that Codeigniter does not like the idea of me trying to load a view from within my own class - do I need to extend my class as part of a core Codeigniter object in order to inherit this ability (bearing in mind I have already tried extending my class as part of the CI_Controller and it did not work) or is there something else I need to do??

My custom class looks like so…

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

class 
Some_class{ 
    
    
public function __construct($allowed NULL$disallowed NULL
    
{
        $this
->allowed $allowed;
        
$this->disallowed $disallowed;
    
}
    
    
public function is_logged_in()
    
{
        
// PUT get_instance() IN THE FUNCTION/METHOD IF USING PHP 4
        // ELSE USE WITHIN THE CONTRUCTOR
        
        
$CI =& get_instance();
        
$CI->load->library('session');
        
        
        if(
$CI->session->userdata('is_logged_in'))
        
{
            $this
->load->view($this->allowed);
        
}
        
else
        
{
            redirect
($this->disallowed);
        
}
        
    }

So essentially is it possible to use $this->load->view(‘abc’) from within a custom class??

]]>
Wordpress installation within Codeigniter tag:codeigniter.com,2011:forums/viewthread/.193634 2011-07-08T11:48:21Z MykMallett Hi, I built a site that uses a lot of procedural PHP for the main body of the site, then has a wordpress multisite installation under a subdirectory that has a number of client blogs

https://nottingham.subverb.net

https://nottingham.subverb.net/blog/moog

I want to rewrite the non-wordpress parts of the site (so everything outside of /blog/) in codeigniter and am just getting to grips with that, but I need to know whether it is possible to just re-install and run the wordpress network, or at least how I could do that?

]]>
jquery and CI tag:codeigniter.com,2011:forums/viewthread/.193606 2011-07-08T06:18:27Z mehwish hi, Can anyone tell me where a .js file is placed and how to load a .js file or how to call it from controller and how to return values from any function of jquery to controller like we do with controller and model (as we call a model’s function and when that model’s function returns a value we place it in a variable)

]]>
dropsauce.com - My first CodeIgniter powered site tag:codeigniter.com,2011:forums/viewthread/.193403 2011-07-06T06:23:07Z 2011-07-06T06:23:58Z gautaml Hi All,

It’s been a few days since I let it loose but I thought I would show off my first CodeIgniter powered site: https://dropsauce.com

It is a file upload service where you can create uploads to named urls (e.g. https://dropsauce.com/my-trip-to-bali/)

Key features:
- Multiple file selection
- Uploads with progress and preview once complete (it’s Flash powered for now)
- Ability to password protect drops/files
- Ability to auto-delete drops and files after a certain period
- No need to sign up.  Just upload anonymously!
- If you sign up you get larger quotas and extensions to how long you can keep your files
- etc.

Give it a try and let me know what you think!

Thanks!

]]>
wordpress shortcode for CI tag:codeigniter.com,2011:forums/viewthread/.193616 2011-07-08T08:32:31Z umefarooq i really like wordpress because of shortcode, really easy to power up theme with short code like creating jquery ui tabs, accordion or image like with lightbox, or formatting your content according to your theme. i was looking for such a library for CI but really difficult to find it. i am working on a project where we want to add jquery ui tabs from backend really difficult for a normal user to add that. i googled and fond shortcode library work with CI in pastbin, here is link to that library

https://pastebin.com/6E48Cfpc

i added some extra features in this library to load defaults from config file, calling helper functions and use with CI template parser library. really thanks to unknown person for posting such a good library on pastebin all credit goes to him. feel free to add more features and your comments

]]>
How to proceed an array post input tag:codeigniter.com,2011:forums/viewthread/.193595 2011-07-08T03:49:06Z Edy S Hi everybody, i just new in codeIgniter, can every body help me proceed my array post input ?
Here the part of my code

//create table for action
echo      form_input().
         
'<table id="resep" class="tbmodule">'.
     
'<tr>'.
     
'<td class="title">No</td>'.
     
'<td class="title">Jenis Obat'.
     
'</td>'.
     
'<td class="title">Jumlah</td>'
     
'<td class="title">Dosis</td>'.
     
'</tr>'.
     
     
'<tr><td>1</td><td>'.form_input('obat[1]','','size="30"').'</td> <td>'.form_input('jumlah[1]','','size="10"').'</td> <td>'.form_input('dosis[1]','','size="10"').'</td></tr>'.
     
'<tr><td>2</td><td>'.form_input('obat[2]','','size="30"').'</td> <td>'.form_input('jumlah[2]','','size="10"').'</td> <td>'.form_input('dosis[2]','','size="10"').'</td></tr>'.
     
'<tr><td>3</td><td>'.form_input('obat[3]','','size="30"').'</td> <td>'.form_input('jumlah[3]','','size="10"').'</td> <td>'.form_input('dosis[3]','','size="10"').'</td></tr>'.
     
'<tr><td>4</td><td>'.form_input('obat[4]','','size="30"').'</td> <td>'.form_input('jumlah[4]','','size="10"').'</td> <td>'.form_input('dosis[4]','','size="10"').'</td></tr>'.
     
'<tr><td>5</td><td>'.form_input('obat[5]','','size="30"').'</td> <td>'.form_input('jumlah[5]','','size="10"').'</td> <td>'.form_input('dosis[5]','','size="10"').'</td></tr>'.
     
''.
     
'</table>'.
         
form_close(); 

in my controller, i want to use data parse that contain like this ( just part ) :

foreach($this->input->post('obat') as $key => $val){
    $resep 
.=$val.'||'.$this->input->post('jumlah['.$key.']').'||'.$this->input->post('dosis['.$key.']').'{}';

My problem now, i cant access to input->post(‘jumlah’) and input->post(‘dosis’) and when i echo $resep ,  It just display the value of input->post(‘obat’). I have try to directly write input->post(‘jumlah[1]’) and it cant still display the value when i submit it.


Please help me ...

]]>