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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 9,210
» Latest member: Kanhaiya Singh
» Forum threads: 66,458
» Forum posts: 417,061

Full Statistics

Latest Threads
Sessions Performance Issu...
Forum: CodeIgniter 3.x
37 minutes ago
» Replies: 3   » Views: 76
Codeigniter CRUD app erro...
Forum: CodeIgniter 3.x
39 minutes ago
» Replies: 3   » Views: 97
CI4 should keep Models ar...
Forum: CodeIgniter 4 Feature Requests
1 hour ago
» Replies: 1   » Views: 27
routing to IIS though I a...
Forum: Installation & Setup
1 hour ago
» Replies: 3   » Views: 100
Using a class as property...
Forum: Installation & Setup
1 hour ago
» Replies: 2   » Views: 104
[Solved] Codeigniter Imag...
Forum: General Help
1 hour ago
» Replies: 2   » Views: 59
errors views and helpers
Forum: General Help
3 hours ago
» Replies: 4   » Views: 73
[Solved] Files-Sessions s...
Forum: General Help
6 hours ago
» Replies: 3   » Views: 109
dynamic input field valid...
Forum: CodeIgniter 3.x
7 hours ago
» Replies: 2   » Views: 134
Reading large Excel files
Forum: Libraries & Helpers
7 hours ago
» Replies: 9   » Views: 365

 
  Using multiple MySQL databases
Posted by: El Forum - 08-09-2007, 03:40 PM - Forum: Archived General Discussion - Replies (3)

[eluser]stevefink[/eluser]
Hi all,

First and foremost, I'm having a blast with the CI learning process! Unfortunately I've run into a hurdle where I'm going to have to ask the community for some insight. I'm working on a small application that requires speaking to two separate databases. I followed the advice listed here in order to achieve this:

http://ellislab.com/codeigniter/user-gui...cting.html

So in config/database.php I've created two elements in the $db array consistent of $db['db1'] and $db['db2']. My questions are the following:

1) Do we leave $active_group defined if we're using multiple databases?
2) Where would be the best place to define the actual DB object instances? The constructor or the index() method?

I wrote the following code in my controller's index():

function index()
{
$DB1 = $this->load->database('db1', TRUE);
$DB2 = $this->load->database('db2', TRUE);

// retrieve all records.
$data['query'] = $DB1->get('tbl_signups');

.. yadda yadda ..
This query is unfortunately is trying to query the database defined in $DB2 (probably cause of a user error. Tongue )

Thanks again for any insight folks!


  best practice of exposing data to a view
Posted by: El Forum - 08-09-2007, 03:18 PM - Forum: Archived Development & Programming - Replies (2)

[eluser]Bacteria Man[/eluser]
I'm using a controller->library->model structure. The controller is extremely thin and is responsible for only displaying the view. The library contains all the business logic and the model interacts with the database.

With the above in mind, I'm trying to determine the best practice of exposing data to a view.

The most obvious way is to pass the data in the second parameter. For example:

Code:
$data['title'] = 'My Blog';
$this->load->view('blogview', $data);

What about data produced by the library? I like to return true/false from my functions. If false, the function failed for whatever reason. If true, the data is defined as an object and available to the view.

I suspect that a combination of both techniques is acceptable.

I'd appreciate any comments and/or a confirmation.

Thanks!


  silly question
Posted by: El Forum - 08-09-2007, 02:20 PM - Forum: Archived Development & Programming - Replies (5)

[eluser]gafro[/eluser]
hey guys,

quick simple question.

where do i place the css directory?

heres my link

<link rel="stylesheet" href="styles/global.css" type="text/css" media="screen, projection" />


  Validation question
Posted by: El Forum - 08-09-2007, 01:38 PM - Forum: Archived Development & Programming - Replies (4)

[eluser]chobo[/eluser]
I was doing some validation with the validation class and I was just wondering where do the variables that you are testing get stored? Currently, I validate the variables and then retrieve them from the post array like this:

Code:
$this->input->post('somefield', true);

Does retrieving the variables using CI's input->post class get the validated variables, or unfiltered ones directly from the form?

Thanks!


  How can I made this ?? - begineer
Posted by: El Forum - 08-09-2007, 12:04 PM - Forum: Archived Development & Programming - Replies (3)

[eluser]fejtis[/eluser]
Hi

i have maybe stupid question. I am thinking on the situation, where I have a web with CodeIgniter and in all pages I want to process something code (for example SQL query). So i must repeat that code in all controllers? Thx


  HTML Table display horizontally/changing orientation
Posted by: El Forum - 08-09-2007, 09:32 AM - Forum: Archived Development & Programming - Replies (2)

[eluser]Carlton[/eluser]
Is it possible to alter the orientation of a table....at the moment I have a table with 60+ columns and 2 rows so ideally would like to display it as 60+ rows and 2 columns. Similar to how you would layout a form I guess.

Is this possible using the table library at all?


  MySQL Connection / PHP complaints
Posted by: El Forum - 08-09-2007, 05:44 AM - Forum: Archived General Discussion - Replies (2)

[eluser]danfloun[/eluser]
Hi,
I've just installed the latest xampp and have installed Code Igniter which so far is looking good. I've run through the tutorials to get to grips with the basics but I've hit a minor problem

Although I seem to have no connection failures I get an error at the top of my index.php when trying to access the MySQL database.

The error:

Code:
A PHP Error was encountered

Severity: Notice

Message: Use of undefined constant database - assumed 'database'

Filename: config/autoload.php

Line Number: 41

My test server:

Apache: 2.2.4
PHP: 5.2.3
MySQL: 5.0.45


My autoload.php

Code:
$autoload['libraries'] = array(database);

My database.php

Code:
$active_group = "default";

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "mypassword";
$db['default']['database'] = "blog";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['active_r'] = TRUE;
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";

Thanks for any help


  Authentication Script
Posted by: El Forum - 08-09-2007, 05:38 AM - Forum: Archived Development & Programming - Replies (5)

[eluser]Kemik[/eluser]
Hello all,

Just wondering whether you think I should code my own authentication script (login, logout, register, forgotten password, remember me).

I can code the register script and the admin backend so I don't really need a full featured plugin but I've never really dove in to cookies and managing how the user would login with CI. I'll also need to be able to call to see if the user is logged in, an admin, etc.

By using a full featured plugin such as FreakAuth I can simply use it straight away after a few tweaks and it'll be easy enough to upgrade later. Plus, the script is very detailed in how it manages the user.

Are there any other auth plugins that I should look at and are still in active development?

Thanks.


  using loaded language file inside controller, possible?
Posted by: El Forum - 08-09-2007, 05:30 AM - Forum: Archived Development & Programming - Replies (4)

[eluser]moonbeetle[/eluser]
In my constructor I load the language file according to the user's preference like this:

Code:
// Load language file
$this->lang->load('products', $this->db_session->userdata('lang'));

in the language file I'm loading I have an entry:
Code:
$lang['next_link'] = 'Volgende';
("Volgende" means "Next" in Dutch)

This works fine and when I load a view file I can use data from my loaded language file. So the controller is perfectly capable of loading the language file and passing the data to the view file. However, what I can't do or can't figure out is how to use the loaded language data directly inside the controller. Why would I want to do this? For setting the config values for pagination where language dependancy is needed for instance.

This works (obviously):
Code:
$config['next_link'] = 'Next'

But this doesn't:
Code:
$config['next_link'] = $this->lang->line('next_link');
nor will this:
Code:
$config['next_link'] = $lang['next_link'];

Does anyone have a solution for this?


  Japanese (multi-byte) characters & email library
Posted by: El Forum - 08-09-2007, 04:15 AM - Forum: Archived Development & Programming - Replies (6)

[eluser]Aaron L.[/eluser]
Hello, In my controller (encoded in UTF-8) I am attempting to send an email which contains Japanese (multibyte) characters. The body of the email comes out fine, but the subject line are just garbled characters. Any ideas/tips/hints/thoughts as to what might be going on here?



  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.