Welcome Guest, Not a member yet? Register   Sign In
  Library vs. Controller
Posted by: El Forum - 10-28-2008, 02:22 AM - Replies (5)

[eluser]pistolPete[/eluser]
I want to ask a general question:

In my application I have several controllers (of course) and some libraries, for example a Layout library and a Login library.
I also could put that code into my subclasses (Frontend_Controller, Backend_Controller) of the Controller class which reside in MY_Controller.php.
Now I want two ask, if there is any advantage in having a Library over extending the controllers.

Thanks in advance,

Pete


  cache & session
Posted by: El Forum - 10-28-2008, 01:54 AM - Replies (1)

[eluser]szazman[/eluser]
hi
i have language name in session eg.
$newdata = array(
'username' => 'johndoe',
'email' => '[email protected]',
'logged_in' => TRUE
'lang' => 'en'
);
$this->session->set_userdata($newdata);

I would like to use cache but when i use caching i can change the language only after cache expires.
How to make caching all languages and read only the one that exists in session???


  Custom membership site with contests and affiliate program... by January!
Posted by: El Forum - 10-28-2008, 01:08 AM - Replies (10)

[eluser]Kevin Smith[/eluser]
So I've been using and really impressed with ExpressionEngine for about a year now, and I'm eagerly awaiting the new version built on CI!

I'm considering my first foray into CI because of a sudden project. A potential client that we met with back in the Spring has suddenly reappeared and is ready to go. Great! But he's fine-tuned his request, and where I was going to originally try to hack out a solution in EE or Drupal, I've decided that the best thing would probably be a custom rolled solution. Now, I know this will be much more time-intensive, but I think in the long run it'll work the best. (But I'm totally open to criticism and suggestion, so feel free to let me have it!)

I'm familiar with PHP in that I can read, troubleshoot, and modify PHP, but I'm not fluent yet. Never really had a reason to need it. But we're seeing our two-man company's workload shift, and the writing on the wall tells me to start getting deeper into programming with something like PHP. I've heard that CodeIgniter is brilliant for beginners, and in taking my own look, it appears to make perfect sense to me. I'm just worried that CI might not be powerful enough to handle my ultimate task, so that's where you guys come in. Help me out here. Is it reasonable to expect that by January I can build a tiered membership site with contests, judges, groups and content that is localized yet available for all to see (aka The Nashville Songwriters' Group) along with an affiliate program? And is CI the framework to use? What about Symfony or any of the other PHP frameworks? (And for extra fun, Ruby on Rails? And no, I don't know Ruby at all.)


  Help with Foreign Keys
Posted by: El Forum - 10-28-2008, 12:39 AM - Replies (7)

[eluser]orokusaki[/eluser]
Hi,

I'm wondering if somebody out there could explain a foreign key set up and usage for me. I don't necessarily need code, but just a logical explanation. Here's what I know:

Foreign keys are used to identify primary keys in other tables

You can only use a foreign key in an InnoDB table (at least in MySQL)


Here's what I really don't understand:

When I first learned about database interaction a year ago, I read about foreign keys. It made sense to me then because they explained it as such that it was not an actual difference from any other column, but rather it was just a normal column that you knew was a "foreign key", so that you could say

SELECT 'column' FROM 'table' WHERE table.column = other_table.column

Pardon my FUBAR syntax above.

I'm just so confused. I don't know if I should use foreign keys or not. If I have a table called posts and another called comments should I use foreign keys to relate them to each other, or should I just use the foreign key-like logic in my programming?


  CI and Zend Guard
Posted by: El Forum - 10-28-2008, 12:19 AM - No Replies

[eluser]devyfriend[/eluser]
hi there

im trying to encrypt ci with zend guard but i got this error
Fatal error: Class ‘CI_Benchmark’ not found
can anybody help me bout this
or perhaps a hint why this happen

regards
devy


  Problem with Last inserted record id
Posted by: El Forum - 10-27-2008, 10:04 PM - Replies (4)

[eluser]Joseph1982[/eluser]
Hello,

I have tested the '$this->db->insert_id();' function but it not returns the correct record id. I have tested the process with multiple insertion in a single query. The code is below:

Code:
class Mytest extends Controller
{

    function __construct()
    {
        parent::Controller();
    
        $this->load->database();
    }

    function index()
    {
        $query    =    "INSERT INTO `test` ( `id` , `name` ) VALUES ('', 'Reneesh'), ('', 'Shaiju')";

        $this->db->query($query);


        echo $this->db->insert_id();

    }
}

Please let me know your suggestions..

Thank You.


  CI 1.7. Encrypt class
Posted by: El Forum - 10-27-2008, 10:00 PM - Replies (2)

[eluser]Unknown[/eluser]
I have problem with Encrypt class

i try to encode string, with cipher BLOWFISH

my code:

Code:
$this->load->library("encrypt");
$this->encrypt->set_cipher('MCRYPT_BLOWFISH');
echo "Secret : ".$this->encrypt->encode("secret");

my result:
Code:
A PHP Error was encountered
Severity: Warning
Message: mcrypt_get_iv_size() [function.mcrypt-get-iv-size]: Module initialization failed
Filename: libraries/Encrypt.php
Line Number: 256

A PHP Error was encountered
Severity: Warning
Message: mcrypt_create_iv() [function.mcrypt-create-iv]: Can not create an IV with a size of less then 1 or greater then 2147483647
Filename: libraries/Encrypt.php
Line Number: 257

A PHP Error was encountered
Severity: Warning
Message: mcrypt_encrypt() [function.mcrypt-encrypt]: Module initialization failed
Filename: libraries/Encrypt.php
Line Number: 258

Tested mcrypt
Code:
echo ( ! function_exists('mcrypt_encrypt')) ? 'Nope' : 'Yup';
it works.

Tested crypt
Code:
echo crypt("secret", 'BLOWFISH');
it works to.


  URL
Posted by: El Forum - 10-27-2008, 09:32 PM - Replies (5)

[eluser]Praveen A P[/eluser]
Hello,

I am trying out CI for the first time. SO if this sounds dumb, please bear with me and help me.

I have a controller, it points to first view page.

The first view page has a link to register, When i click on register, It comes back to the controller and from there, it is sent to the next view.

The next view has a form with fields to enter Username and Password, and a Register button. When I click on register, It displays 404 page.

Expected behaviour, I have and echo statement in the controller where it should go next, however, it does not go to that function.

Please help me.

Here is the code if it helps.



Controller Code

Code:
<?php


class Ts_start extends Controller {


    
    function Ts_start(){

        parent::Controller();

        $this->load->helper('url');

        $this->load->helper('form');
    }
    

    
    function index(){

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

    }



    function prepareRegister(){

        echo 'halwa...';

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

    }



    function register(){

        echo 'doosra...';

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

    }

    function insertDB(){

        echo 'regestering...';

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

    }

}




First view page

Code:
<html>
<head>
<title>Stories</title>
</head>
<body>

<p>THIS IS THE SITE</p>

<p></p>

<p>&lt;?php echo anchor('ts_start/prepareRegister', 'Register');?&gt;</p>

&lt;/body&gt;
&lt;/html&gt;




This is the next view

Code:
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Stories&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

<p>THIS IS THE SITE</p>

<p>&lt;?php echo form_open('ts_start/register');?&gt;</p>

    &lt;input type="text" value="" name="uName"&gt;&lt;/input>
    <p>&nbsp;</p>
    &lt;input type="password" value="" name="password"&gt;&lt;/input>
    <p>&nbsp;</p>
    &lt;input type="submit" value="REGISTER"&gt;&lt;/input>

&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;



THIS IS THE VIEW THAT SHOULD BE DISPLAYED WHEN I SUBMIT THE FORM

Code:
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Stories&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

<p>THIS IS THE SITE</p>

<p>USER REGISTRATION DONE.</p>


&lt;/body&gt;
&lt;/html&gt;


The Problem I am facing is that when I submit the form I get a 404 page not found error.


Also, when I see the URL it looks quite weired.

here it is:
Code:
http://localhost/ts/index.php/ts_start/index.php/ts_start/register

Is there some problem with the URL?

Please help me.


  CI_DB_mysql_driver::db_set_charset()
Posted by: El Forum - 10-27-2008, 09:01 PM - Replies (1)

[eluser]Unknown[/eluser]
Can anybody help me with this error plz

Fatal error: Call to undefined method CI_DB_mysql_driver::db_set_charset() in /myhomepath/CodeIgniterCore/database/DB_driver.php on line 198

Never Seen this before

Thanks

Ashiq


  View with Parser not working.
Posted by: El Forum - 10-27-2008, 08:29 PM - No Replies

[eluser]Lazos[/eluser]
Why is not possible to use views together with parser?

The header.tpl (template) is not loading. What is loading is after the parser.

Code:
&lt;?php
class Header extends Controller {

    function index()
    {
        $data = array(
              'site_menu_title_rot' => array(
                                      array('menu_title' => 'Title 1'),
                                      array('menu_title' => 'Title 2'),
                                      array('menu_title' => 'Title 3')
                                      )
            );
        $this->load->view('header.tpl');
        $this->parser->parse('menu.tpl', $data);
        $this->load->view('footer.tpl');
    }
}
?&gt;


EDIT: Stupid mistake. I accidentally downloaded the 1.6.3 version... Please delete it because this problem was fixed in Version 1.7.0


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

Username
  

Password
  





Latest Threads
Version number stays un-u...
by trunky
1 hour ago
codeigniter4/queue Not lo...
by mywebmanavgat
5 hours ago
Array to HTML "Table"
by HarmW94
6 hours ago
shortcodes for ci4
by xsPurX
7 hours ago
TypeError when trying to ...
by b126
Today, 12:04 AM
Webhooks and WebSockets
by InsiteFX
Yesterday, 10:39 AM
Retaining search variable...
by pchriley
Yesterday, 05:46 AM
Reading a session variabl...
by xanabobana
Yesterday, 05:05 AM
Update to v4.5.1, same us...
by kenjis
04-17-2024, 07:47 PM
Codeigniter 4 extend core...
by Semsion
04-17-2024, 05:08 AM

Forum Statistics
» Members: 84,584
» Latest member: kalyt72
» Forum threads: 77,560
» Forum posts: 375,900

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB