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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 12,642
» Latest member: smtjunior
» Forum threads: 68,806
» Forum posts: 428,553

Full Statistics

Latest Threads
is this migration bug?
Forum: CodeIgniter 4 Support
31 minutes ago
» Replies: 2   » Views: 49
Custom Validation doesn't...
Forum: CodeIgniter 4 Support
1 hour ago
» Replies: 3   » Views: 78
Chronological order of da...
Forum: Best Practices
1 hour ago
» Replies: 12   » Views: 223
Alpha.4 coming Dec 15th
Forum: CodeIgniter 4 Roadmap
10 hours ago
» Replies: 2   » Views: 182
Redirect
Forum: CodeIgniter 4 Support
11 hours ago
» Replies: 3   » Views: 107
CI 3.1.9 session timeout ...
Forum: General Help
Today, 05:29 AM
» Replies: 8   » Views: 244
Once the model is loaded ...
Forum: Best Practices
Yesterday, 08:37 PM
» Replies: 1   » Views: 78
How to create sitemap XML...
Forum: Lounge
Yesterday, 04:29 AM
» Replies: 2   » Views: 162
CI4 Supporters
Forum: CodeIgniter 4 Development
12-07-2018, 03:00 PM
» Replies: 10   » Views: 2,734
Upgrade CI2x to CI3 (USA ...
Forum: Jobs
12-07-2018, 12:15 PM
» Replies: 1   » Views: 111

 
  Multiple database connection problem
Posted by: El Forum - 10-11-2007, 08:53 AM - Forum: Archived Development & Programming - Replies (4)

[eluser]Unknown[/eluser]
I am not able to open the multiple database connection using hooks.Here is the method I am using for this.

function loadDatabaseInfo()
{
// set the XML file name as a PHP string
$databaseConfList = getcwd()."/conf/database.xml" ;
// load the XML file
$xml = @simplexml_load_file($databaseConfList) or die ("no file loaded") ;
// assign the listName element to a string

// $xml->databaseGroup[1]->StudioName = "hello1";
// $filedata = $xml->asXML();
//
// file_put_contents($databaseConfList,$filedata);
$i = 0;
foreach ($xml->databaseGroup as $studioList)
{
$config = null;
$config['name'] = $studioList->Name;
$config['hostname'] = $studioList->configuration->Server;
$config['username'] = $studioList->configuration->DBUser;
$config['password'] = $studioList->configuration->DBUser;
$config['database'] = $studioList->configuration->DBPassword;
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;
$config['active_r'] = TRUE;
$DB[i] = $this->load->database($config);
echo $i++;
}

return null;


Can anybody please suggest how to get this done.


  [help]problem with ci sessions
Posted by: El Forum - 10-11-2007, 08:45 AM - Forum: Archived Development & Programming - Replies (4)

[eluser]cesarius[/eluser]
Hello!
Ive got a problem here:
I want to have acsess to the site wich is located at a computer in internal network/
the name of it is netcomp
on an internet site (http://www.xxx.ru) it all works fine but with this name i can not store session it says tha loggedin is rfalse however it must be true/// maybe you could help me how to configure config.php? here is mine:

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

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|    http://www.your-site.com/
|
*/
$config['base_url']    = "http://netcomp/";
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'session_cookie_name' = the name you want for the cookie
| 'encrypt_sess_cookie' = TRUE/FALSE (boolean).  Whether to encrypt the cookie
| 'session_expiration'  = the number of SECONDS you want the session to last.
|  by default sessions last 7200 seconds (two hours).  Set to zero for no expiration.
|
*/
$config['sess_cookie_name']        = 'ci_session';
$config['sess_expiration']        = 7200;
$config['sess_encrypt_cookie']    = FALSE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']        = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent']    = TRUE;

/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path'   =  Typically will be a forward slash
|
*/
$config['cookie_prefix']    = "";
$config['cookie_domain']    = "kontsevoisb";
$config['cookie_path']        = "/";
thanks for your help


  Ideas for database structure / Dictionary
Posted by: El Forum - 10-11-2007, 08:22 AM - Forum: Archived Development & Programming - Replies (9)

[eluser]trice22[/eluser]
Hello and sorry, if this a bit of a vague topic, but I'm in the early stages of a new project and not really experienced with the development of database structures—so every input would be very welcome.

Here's what I want to do:
I'm planning on a small app. that will work a little like a dictionary. That means I've at least two languages (let's say English and German) and vocabulary for both of them.
That would call for two tables:

Code:
English with ID and word and
German with ID and word

And since one word (like "to put") can have more than one meaning ("setzen", "stellen", legen") I'll need a third table for the relations between table "English" and "German".

Something like
Code:
ID, ID_eng, ID_ger
.
Am I correct so far? Is there a better way to handle something like this?

Now here's my bigger problem:
The amount of languages is dynamic. Let's say, somebody could add French or Chinese.
How would I handle the relations then? If I'd have an extra table for each relation I'll very soon reach a gigantic amount of tables. There gotta be a better way.
Any ideas, links or general input to the dictionary-in-a-database topic?

I'm in the planning stage and very grateful for every idea.
Thanks a lot,
-trice

P.S.: I know this is not necessarily CI related, but since the app. is going to be developed with CI and everyone in here always very helpful, I'm still going to give it a shot.


  callback from model
Posted by: El Forum - 10-11-2007, 08:16 AM - Forum: Archived Development & Programming - Replies (12)

[eluser]smith[/eluser]
For those interested in keeping validation inside model. As you all know you can't use callback method from model, or you can but callback function has to be inside controller. I have tried something else, so you can use my method if you want:

make new validation.php that extends CI validation and put it in application/libraries:

MY_Validation.php

Code:
class MY_Validation extends CI_Validation {

    function MY_Validation()
    {
        parent::CI_Validation();
    }
    
    
    function additional_check($array)
    {
        // do something with your data, set error message, return false or true
    $this->set_message('additional_check', 'error');
    return false;
    }
}

in your controller construct load library and forms model:
controller:
Code:
$this->load->library('validation');
$this->load->model('forms');

in your model use callback as you would from controller, but without "callback_" prefix:

model:
Code:
$rules['some_field']   = "required|additional_check";

callback will work without any problem, and you get to keep validation inside model, forms in one model, callbacks in one library. I like it that way, it keeps my controllers pretty clean, so if anyone wants to use this too, be my guest Smile


  Javacript and CI form arrays
Posted by: El Forum - 10-11-2007, 05:27 AM - Forum: Archived General Discussion - No Replies

[eluser]PaddyX[/eluser]
Hi,

This is probably a very simple question. Using the form helper I am passing an associative array containing the data I want the form to contain:

$data = array('name' => 'username', 'id' => 'username');

I also want to associate a JavaScript script with each form element. I can do this by:

$explain = 'onmouseover="explain(\'sidebar\', \'<p>Why do we need ..?</p>\')"

then

form_input($data, $explain)

Which is great. But I would like the JavaScript to have different variables passed to it depending on the element in question. Is it possible to do this by for example defining the JavaScript to be passed in the $data array rather than when the form is being written?

I hope that this makes sense.

Thanks

Paddy


  how to get data from html page and insert into database?
Posted by: El Forum - 10-11-2007, 05:17 AM - Forum: Archived General Discussion - Replies (3)

[eluser]Unknown[/eluser]
I am fresh for php. would you please tell me how to get data from html page and insert into database. i found the CI user guide tell us how to render data, however, it does not tell us how to get data. please refer the following example:


&lt;input id="username" name="username" type="text" /&gt;
&lt;input id="pwd" name="pwd" type="text" /&gt;
&lt;input id="Submit1" name="submit1" type="submit" value="submit" /&gt;


there are 3 input fields in the page. how i can get the data from "username" and "pwd" textbox in the controller when visitor clicks on "submit"? and how to insert them into database?
thanks in advance.


  [validation] problem with validation library and htmlentites (strange conversion)
Posted by: El Forum - 10-11-2007, 04:10 AM - Forum: Archived Development & Programming - Replies (2)

[eluser]ariok[/eluser]
Hi !
I have a problem with this code

Code:
$arr_data = array (
   "first"=>htmlentities ($this->validation->first),
   "last"=>$this->validation->last,
   "email"=>$this->validation->email,
   "username"=>$this->validation->username,
   "password"=>$this->validation->password,
   "sede"=>$this->validation->sede
);

$this->db->insert("pnl_users",$arr_data);

In "first" field i try to use an htmlentites conversion, but when i insert the char 'à'
i obtain this conversion "Atilde sup2"(&Atilde;&sup2Wink instead of "agrave"(&agraveWink

Could you help me??

(i also tried to apply html entities directly in rules with $rules["first"]="htmlentities" but nothing changes)


  New UI Library in development
Posted by: El Forum - 10-11-2007, 03:20 AM - Forum: Archived Libraries & Helpers - Replies (7)

[eluser]Unknown[/eluser]
Hello, starting today I made public a small proof of concept on building interfaces in php directly with the help of jQuery UI components.

Details are Here in the wiki.

Simple usage as:

Code:
$this->load->library("UI");
$this->setTheme("flora");

$this->ui->open("tabs");
$this->ui->addTab("Some Tab", "<h1>Yay</h1>");
$this->ui->addTab("Some Other Tab", "<h1>Hooray</h1>");
$this->ui->close("tabs");

$this->load->view("someView", array("tabs" => $this->ui->tabs()));

produces quality tabs in any layout.

This library uses an extended CI Loader class that will be discussed soon.

For details and download go here


  Blank page weirdness.
Posted by: El Forum - 10-11-2007, 01:19 AM - Forum: Archived Development & Programming - Replies (3)

[eluser]Unknown[/eluser]
Hi,

I have a problem where a blank page is returned after I make a call to a search class I have but if I go to the controller and put in a simple echo statement it all works -- here's the weirdness -- if I then take the echo statement out of the controller (i.e. put the controller back to the way it was) it STILL works.

It carries on working for me for as long as I'm on the site but if I try the next day it's back to not working. The situation occurs in both IE and Firefox.

Of course I'd be grateful if anybody could shed some light?


  dynamic functions
Posted by: El Forum - 10-10-2007, 11:22 PM - Forum: Archived Development & Programming - Replies (4)

[eluser]Unknown[/eluser]
Hi there.. im new to code igniter.. started it about 3hours ago. and im in the middle of transforming my site to use CI framework. and im wondering how to go about this.

I have several users who are members of my site and part of the development team.
if you go to
about.php?u= {their username} it brings up a little bio
so how would i make it so that if they go to
about/{username}

i know i can go to about.php and make a function for each of their usernames and that will work, but i was hoping that there is another way to do it.

im sure this has been addressed before and its probably somewhere on the wiki or the forum but couldnt find it. Any help is greatly appreciated.



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