Welcome Guest, Not a member yet? Register   Sign In
  SimplyPost - Forum built on CI
Posted by: El Forum - 02-25-2008, 11:21 AM - Replies (5)

[eluser]Pascal Kriete[/eluser]
I spent the morning hacking the core to get a modular layout and then spent the afternoon building a forum. It's very early alpha, but I want to get some feedback before I start to implement the little things.

Official blog entry is here. And the download is here.


  help- native sessions remember me
Posted by: El Forum - 02-25-2008, 11:13 AM - Replies (3)

[eluser]sixpack434[/eluser]
Please help :-)

I have been using CI Sessions until I found out that some users were having problems creating a session i.e. couldn't login. This mostly happened with IE, on the particular machine I was testing on it had IE7 and Vista.

I managed to solve the problem by using the Native session library in the wiki. However, now the session seems to expire after a few minutes and I so missed not having to have to login each time I visit the website.

Is there anyway I can implement a remember me feature using native sessions?

If not, is there any other library out there that ALL USERS can use without any issues especially with IE? Also, I'd rather not change any code, I like the native session library because I grabbed the file and put it on the server without any code changes.

Thanks


  Creating Accounts
Posted by: El Forum - 02-25-2008, 10:49 AM - Replies (6)

[eluser]cristian_c[/eluser]
So this is what I need to do.


  Typo / Error in Userguide: Database Queries - Protecting Identifiers
Posted by: El Forum - 02-25-2008, 10:32 AM - Replies (1)

[eluser]m4rw3r[/eluser]
I've found an error in the User Guide, section Database Queries - Protecting identifiers

The protect_identifier() method seems to be non existent in the db class (PHP cannot find it).
I have now used _protect_identifiers() instead, It works (using MySQL driver).

$this->db->protect_identifier('table_name');
should probably be
$this->db->_protect_identifiers('table_name');
unless you add a new function in the db class / MySQL driver


  Will CI change with next EE
Posted by: El Forum - 02-25-2008, 09:45 AM - Replies (6)

[eluser]louis w[/eluser]
The next big rev of EE is not going to be backwards compatible, just wondering if CI is being rewritten at the same time and will not be compatible. I am in the midst of diving into CI, I would hate to invest all the time to understand it's inner workings and then have to learn a whole new system.


  DB Errors log
Posted by: El Forum - 02-25-2008, 08:40 AM - Replies (3)

[eluser]gon[/eluser]
Hi,

How do you guys keep a log of possible failed queries?
When setting db_debug to true, they get logged, but an error screen is also shown.
Also, tables get locked when using transactions.


So what I do is modify the display_error function, on DB_driver.php:

Code:
function display_error($error = '', $swap = '', $native = FALSE)
    {
        return false;


//        $LANG = new CI_Lang();
        $LANG = new CI_Language();
        $LANG->load('db');

        $heading = 'Database Error';
        
        if ($native == TRUE)
        {
            $message = $error;
        }
        else
        {
            $message = ( ! is_array($error)) ? array(str_replace('%s', $swap, $LANG->line($error))) : $error;
        }

        if ( ! class_exists('CI_Exceptions'))
        {
//            include(BASEPATH.'core/Exceptions'.EXT);
            include(BASEPATH.'libraries/Exceptions'.EXT);
        }
        
        $error = new CI_Exceptions();
        echo $error->show_error('An Error Was Encountered', $message, 'error_db');
        exit;
    }

Is there another way to do this without touching inside CI?

I would suggest to add a different database config param for logging and displaying errors.

Regards.


  Libraries or Models, favouritism?
Posted by: El Forum - 02-25-2008, 08:28 AM - Replies (24)

[eluser]Hyra[/eluser]
Hey hey,

So i'm (still) in the progress of porting my existing community site to CI. Big fun (actually, it is, really!)

Although i'm running into some issues and decided to take a step back and think things over.

Currently i'm having 2 issues which, i think, cover all related bottlenecks.

First up .. controllers.

Let's take an example .. At the site people can visit other users and see, for example, their Profile, Gallery and Blog. In return, people can maintain their own Profile and Blog.

Following set of controllers with methods could be used:

For the users (artists) people can visit:

Code:
artist.php -> index() (profile)
           -> blog()
           -> blog_entry($id)
           -> gallery()
           -> artwork($id)
.. more for adding comments on an artwork, comment the profile page, etc. etc.

Then, for the user himself, to maintain his blog:
Code:
my_blog.php   -> index() (profile)
              -> add()
              -> edit($id)
              -> delete()
Many more controllers like above, for maintaining artworks (my_artwork.php) and so on.

Now, this seems, and in fact is, a bit cumbersome. Lots of repetive tasks within the controllers, but for other parts of the site. I.e. add a comment to an artwork, or on a blog entry.

Of course, an option would be to group all those methods into one controller, but this would make the code even less maintainable/overviewable.


Extending on this, there's "issue" number 2: Models or Libraries.

Let's take the blog entries as the same example. Would it be wise to create a library "blog" which has methods for just about anything? Meaning: create an entry, handle editing and comments by other visitors, etc. Or would that classify as a model. Or even a combination? I'm not sure what the best way to go is.

I'm finding it hard to define the difference between a model and a library other than what i can find throughout the documentation that a model would handle all the database actions, and a library is used for (complicated) tasks. But this would mean I would have to go with a combination of the 2, ending up with:

controller my_blog.php
library blog.php which handles business logic called from the controller
model blog.php (in fact not possible due to name conflicts) which handles database actions.

A library could do both database and "thinking" tasks, thus making the model obsolete. But .. wouldn't this be wierd?


So yes, I'm rambling now Smile

I could do with a chatroom on IRC (alas, the ports are closed at work) or someone to MSN with to discuss these things. Or maybe someone can make sense of the above and give me some pointers?


  URI Routing
Posted by: El Forum - 02-25-2008, 06:45 AM - Replies (9)

[eluser]simonspoken[/eluser]
I'm trying to add search functionality to my site, but would like to avoid using javascript to rewrite the url when the form is submitted. So:

/search/?s=search+query

(instead of /search/search+query)

However, I'm having a bit of trouble with the URI routing.

I've got /search/ working fine, but would like to rewrite the results page to something like this:

$route['/search/\?s=(.*)'] = "mysite/search/$1";

This isn't working - any ideas what I'm doing wrong?

EDIT: I've just tested the above regular expression at: http://regexlib.com/RETester.aspx

It pulls out the values perfectly. Wonder why CI isn't...


  Can i create controller name like contoller-name i.e can i create contoller using “-”?
Posted by: El Forum - 02-25-2008, 06:28 AM - Replies (3)

[eluser]manish[/eluser]
Can i create controller name like contoller-name i.e can i create contoller using “-”?
i have crated controller such as my-controller but it’s not working
Thanks in advance ?


  models in models?
Posted by: El Forum - 02-25-2008, 05:31 AM - Replies (3)

[eluser]zauber[/eluser]
How would I go about loading models inside models?

I have one model called "site", in which there is a function "create", which, quite simply, creates a site. Now, in my setup, creating a site implicitly requires creating an "account". So in the create function of site, I tried:

Code:
function create(){
    $this->load->model("account");
    $this->account->create(...);
}


but apparently, calling create on account fails, because account is not an object. Loading account in the controller works (has been verified).

Is this the way its supposed to be? I'm not sure I understand how the loading is supposed to work.

UPDATE: apparently, loading the account model in the constructor of the site model works. But, this means I will load the account model every time I need to do something with the site model, which is only useful in a fraction of the cases - so it's not very optimal. Is there a way to just load the account model inside the functions of the site model that need it?


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

Username
  

Password
  





Latest Threads
SQL server connection not...
by kenjis
10 minutes ago
CVE-2022-40834 SQL Inject...
by kenjis
57 minutes ago
Retaining search variable...
by pchriley
1 hour ago
How to use Codeigniter wi...
by sr13579
2 hours ago
Disable debug output in v...
by groovebird
2 hours ago
CI 4.5.1 CSRF - The actio...
by kenjis
4 hours ago
CodeIgniter v4.5.0 Releas...
by kenjis
4 hours ago
Cache best practice?
by BhambriRohunu
5 hours ago
Bug with sessions CI 4.5....
by InsiteFX
5 hours ago
Codeigniter Shield Bannin...
by kenjis
10 hours ago

Forum Statistics
» Members: 85,327
» Latest member: Tripohlzz
» Forum threads: 77,578
» Forum posts: 375,994

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB