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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 9,178
» Latest member: mayankgaur5780
» Forum threads: 66,439
» Forum posts: 416,976

Full Statistics

Latest Threads
Switch button active/inac...
Forum: General Help
1 hour ago
» Replies: 1   » Views: 24
SSL Integration
Forum: General Help
7 hours ago
» Replies: 1   » Views: 67
What should we call the C...
Forum: CodeIgniter 4 Development
Yesterday, 09:27 PM
» Replies: 20   » Views: 703
Sitebuilder with Codeigni...
Forum: Lounge
Yesterday, 08:47 PM
» Replies: 1   » Views: 148
Passing parameters to mod...
Forum: CodeIgniter 3.x
Yesterday, 06:18 PM
» Replies: 1   » Views: 92
[Solved] Database Driven ...
Forum: General Help
Yesterday, 05:35 PM
» Replies: 2   » Views: 108
foreach in foreach
Forum: General Help
Yesterday, 12:06 PM
» Replies: 0   » Views: 18
Resize after upload
Forum: CodeIgniter 4 Support
Yesterday, 05:54 AM
» Replies: 0   » Views: 79
encryption_key in CI 3.x
Forum: Installation & Setup
Yesterday, 12:35 AM
» Replies: 1   » Views: 100
oops in codeigniter
Forum: Choosing CodeIgniter
08-18-2017, 11:11 PM
» Replies: 0   » Views: 55

 
  Migration Advice
Posted by: El Forum - 07-12-2007, 03:51 PM - Forum: Archived General Discussion - Replies (4)

[eluser]richard_ctv[/eluser]
Hello.

I am in the process of planning the migration of two applications to CI. Both use 'legacy' code in that it mixes to a great degree php and html output. I am quite new to MVC frameworks but have been working an on app using CI for the last couple of weeks. It seems fairly simple to write something from scratch, but migration...

Both apps were written about 5 years ago, and require new features. I want to move them into CI as neither are MVC and adding new features means a lot more spaghetti code. And not having looked at the code for such a long time, I have to go through and work out how it all works! Probably better to do the migration and relearn (and clean up) the code as I go.

The structure of the main app is that it runs mostly of a single index.php file. You can read a full overview of the system in Linux Journal. The system is very stable and fast, just a bit messy to extend, hence the desire to move it to a framework. (We are about to move it to new faster hardware and update to php5 and mysql5, both from v4).

The app includes a whole bunch of files - for sessions, user authentication, cookies and access to objects in the database - and these are in directories below the site root. Fairly standard stuff. There is an additional large group of included files that contain classes for objects that represent items in the db. This is so I can go $object->print or $object->save and not have to worry about the underlying table differences.

There is also a complex query compiler that works in a similar way to the lucene query parser (although it pre-dates it), allowing complex search constructs. It also allows multiple data sources to be searched, regardless of the schema, and returned to the user in a simple format. This, I want to retain as it is what makes the system so powerful from the users' point of view (and represents a significant time investment).

I want to retain as much of the good code as possible, passing out data in arrays, as you do for MVC.

May main concern is how to move all the class files into CI in a structured and logical way, and then convert the descendant classes to be (i expect) libraries).

Other questions I have are: is search a library or a model. Ditto the object classes which access the DB.

Suggestions on restructuring this for CI and any other tips that come to mind would be appreciated!


regards,

Richard

======
basic structural overview:

root/htdocs/index.php
edit.php
help.php

root/includes/search.inc.php
other includes

root/includes/recordtypes/record.inc.php
other classes extended from record


  MySQL and extended ASCII
Posted by: El Forum - 07-12-2007, 02:16 PM - Forum: Archived Development & Programming - Replies (4)

[eluser]Xandrios[/eluser]
Hi,

I noticed that string values from my MySQL database are not properly printed with CI. A simple separate PHP script that echoes the same values works fine. However with CI (using an activerecord query) the 'á' will become an '?' and so on.

I am guessing this has something to do with some kind of Character encoding. The MySQL tables are set to 'latin1_swedish_ci'. Is it possible to somehow adjust the char encoding CI uses? Or could something else be the problem?

Running PHP5 with MySQL 5.

Thanks Smile


  FreakAuth isValidUser( ) problem
Posted by: El Forum - 07-12-2007, 01:32 PM - Forum: Archived Libraries & Helpers - Replies (2)

[eluser]Unknown[/eluser]
I have installed FreakAuth on my website and everything appears to be working. I use the isValidUser method to print a different menu for users that are logged in. This happens on every page that is displayed.

Whenever I login and navigate to any page within the website three times, the isValidUser method is no longer returning true and therefore shows the default menu.

My menu code looks like this:

Code:
<ul>
    <li>&lt;?=anchor('home', 'Home')?&gt;</li>
    &lt;?php if (isValidUser()) { ?&gt;
        <li>&lt;?=anchor($this->config->item('FAL_changePassword_uri'), 'Manage')?&gt;</li>
    &lt;?php } else { ?&gt;
        <li>&lt;?=anchor($this->config->item('FAL_register_uri'), 'Register')?&gt;</li>
    &lt;?php } ?&gt;
</ul>


  log_message when db_debug is false
Posted by: El Forum - 07-12-2007, 01:27 PM - Forum: Archived Development & Programming - No Replies

[eluser]Unknown[/eluser]
For production code, I dont want to display database errors to the user via display_error, I want them logged to a file.

So I set:
- error_reporting(0) in index.php
- db_debug = FALSE in config/database.php
- set log_threshold appropriately in config/config.php
- make sure my logs directory is writable

This exposes a bug in DB_driver.php:

I think that code like this:
if ($this->db_debug)
{
log_message('error', 'Invalid query: '.$sql);
return $this->display_error('db_invalid_query');
}
should be changed to:
log_message('error', 'Invalid query: '.$sql);
if ($this->db_debug)
{
return $this->display_error('db_invalid_query');
}

so that database errors will be logged even when db_debug is false.

Many of the display_error instances in DB_driver.php are already written this way, but others (including 2 in the main query function) need this fix so that log_message will work when db_debug is false.


  Problem with escaping in query.
Posted by: El Forum - 07-12-2007, 01:02 PM - Forum: Archived General Discussion - Replies (1)

[eluser]Unknown[/eluser]
Hi, sorry for my english.

I have a problem with escaping in mysql queries. It looks so:

Code:
...
$data['age'] = 'age + 1';
echo $this->db->update_string('table', $data, $where)

This code returns "... age = 'age + 1'" and it does not have an effect.

Unfortunately i have to use this database class, because i use loops and i have different count of variables to update in query.

Thanks for answer.


  Spelling error 'unsuported'
Posted by: El Forum - 07-12-2007, 12:14 PM - Forum: Archived Development & Programming - No Replies

[eluser]Unknown[/eluser]
If you search all codeigniter files with "grep -r unsuported" you will see 16 places where unsupported is misspelled.


  Displaying Messages and Notices
Posted by: El Forum - 07-12-2007, 09:05 AM - Forum: Archived Development & Programming - Replies (8)

[eluser]BrandonDurham[/eluser]
I'm looking for a simple way to display friendly messages to the user when actions are taken or when an action can't be performed—something like, "The ___________ entry has been updated" or "I'm sorry, that entry is locked and cannot be updated". How do you guys like to do this?

The problem I'm having is that I often use redirects after forms are successfully submitted to essentially clear all POST data, and I can't think of a clean way to display a message on the new page.

I appreciate any suggestions. Thank you.


  Route Confusion
Posted by: El Forum - 07-12-2007, 07:37 AM - Forum: Archived Development & Programming - Replies (6)

[eluser]Phunky[/eluser]
Please excuse me if i am being outright dumb but i just cant grasp how to setup the routes i wish.

Im very new to IC and have always struggled to get to grips with other forms of MCV Frameworks such as CakePHP and so.

I'm setting up a Controller that will handle all Static content pages in my application that do not tie in with anything.

Such as Welcome, about, contact etc...

Im struggling to setup the route correctly as i wish to have the pages on the base of the domain like http://www.site.com/about/ or http://www.site.com/welcome/

How do i go about this without setting up each one manually??


  Mysql database Connection pooling with CI?
Posted by: El Forum - 07-12-2007, 06:39 AM - Forum: Archived Development & Programming - Replies (3)

[eluser]woracal[/eluser]
Has anyone implemented/used connection pooling with MySql through CI? Appreciate some comments.....


  URIs and optional parameters
Posted by: El Forum - 07-12-2007, 06:33 AM - Forum: Archived Development & Programming - Replies (12)

[eluser]adrian westlake[/eluser]
Hi,

Just starting to write my first commercial application in CI, but have a questions regarding the segment url format as opposed to the traditional query string.

What if I have a function with two optional parameters. In other words each one has a default value if not passed.

Code:
function myFunction($param1 = "default", $param2 = "default"){

}

With the traditional GET method it is fine as it associates the keys and values.

But with the segment method if I passed

Code:
www.mydomain.com/controller/function/param

How would I know if the param was for the first or second optional parameter. In other words I have to pass all parameters for a function to ensure I know which is which. Does that make sense???



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