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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 10,784
» Latest member: franzCI25
» Forum threads: 67,409
» Forum posts: 421,572

Full Statistics

Latest Threads
Get special record positi...
Forum: General Help
10 minutes ago
» Replies: 1   » Views: 14
Garbage collection
Forum: General Help
43 minutes ago
» Replies: 0   » Views: 9
About session
Forum: General Help
1 hour ago
» Replies: 2   » Views: 31
localhost Website
Forum: General Help
2 hours ago
» Replies: 7   » Views: 205
What will happen If i lim...
Forum: General Help
3 hours ago
» Replies: 14   » Views: 830
Make safety api
Forum: General Help
5 hours ago
» Replies: 4   » Views: 194
Send many emails
Forum: General Help
5 hours ago
» Replies: 6   » Views: 234
large attachment cannot b...
Forum: Libraries & Helpers
7 hours ago
» Replies: 1   » Views: 34
Save Codeigniter config d...
Forum: Best Practices
Yesterday, 12:14 PM
» Replies: 3   » Views: 176
PHP / jQuery Developer Ne...
Forum: Jobs
Yesterday, 11:01 AM
» Replies: 13   » Views: 5,292

 
  config pagination
Posted by: El Forum - 09-27-2007, 08:47 PM - Forum: Archived Development & Programming - Replies (4)

[eluser]easymind[/eluser]
I have made a pagination.php file in system\application\config:

Code:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
$config['cur_tag_open']  = '<span style="font-weight: bold; font-size: 13pt;padding: 0 0 0 2px">';
$config['cur_tag_close'] = '</span>';
$config['first_link']    = '&lt;&lt;';
$config['last_link']     = '&gt;&gt;';
?&gt;
In my controller:
Code:
$this->load->library('pagination');
$this->pagination->total_rows = count($data['news']);
$this->pagination->per_page   = '5';
$this->pagination->base_url   = site_url('/news/page');
$data['pagelinks'] = $this->pagination->create_links();

It seems that the config items are not read. Or not passed to the pagination lib. Does anyone have the same problem?


  download SWFUpload
Posted by: El Forum - 09-27-2007, 08:32 PM - Forum: Archived General Discussion - Replies (1)

[eluser]zeratool[/eluser]
Hello people,

Could someone pls. provide a link to download files of this?
http://codeigniter.com/wiki/SWFUpload/

cannot find the files from that url, thanks so much.


  __get() and __set() with 1.5.4
Posted by: El Forum - 09-27-2007, 07:47 PM - Forum: Archived General Discussion - Replies (8)

[eluser]Unknown[/eluser]
Hi, hoping someone can point me to a workaround here. I've cut everything down to a minimal example. First, the model:

Code:
&lt;?php

class DummyModel extends Model
{
    private $data = array( 'Int' => 0, 'String' => '');

    public function DummyModel()
    {
        parent::Model();
    }

    public function __set( $name, $value )
    {
        $f = "valid{$name}";
        if ( $this->$f( $value ) )
        {
            $this->data[$name] = $value;
            return true;
        }
        throw new DummyModelException( "Invalid {$name}" );
    }

    private function validInt( $Int )
    {
        if ( is_numeric( $Int ) ) return true;
        throw new DummyModelException( "Invalid Int" );
    }

    private function validString( $String )
    {
        if ( strlen($String) < 255 ) return true;
        throw new DummyModelException( "Invalid String" );
    }
}

class DummyModelException extends Exception {}

?&gt;

Then, the controller:

Code:
&lt;?php
class Dummy extends Controller
{
    function Dummy()
    {
        parent::Controller();
        $this->load->model('DummyModel');
    }
}
?&gt;

And the error:

Code:
Fatal error: Call to undefined method DummyModel::valid_ci_scaffolding() in
C:\web\system\application\models\dummymodel.php on line 15

I know what's happening - __set() is grabbing a call to set_ci_scaffolding() for itself, munging it into "valid_ci_scaffolding" (line 14), and attempting to call the non-existent method (line 15).

The causal error is the grabbing of the set_ci_scaffolding() call by the __set() magic method, and I don't have a clue how to suppress/work around that without stirring CI's entrails with a stick. Thanks in advance for any insight.

(BTW, I know that's not sensible validation, they're just placeholders).


  Show all posted data
Posted by: El Forum - 09-27-2007, 07:38 PM - Forum: Archived Development & Programming - Replies (3)

[eluser]Lobosaurus[/eluser]
Hello,

how can I display all data in $_POST using $this->input->post(). My form is a part of quiz system where names attributes are question id´s and values are answer id´s and I don´t know exactly which will be randomly selected to use $this->input->post('variable').


  Relative Dates & Times
Posted by: El Forum - 09-27-2007, 05:56 PM - Forum: Archived Development & Programming - Replies (1)

[eluser]tribalab[/eluser]
I'm working on the message/mail part of my application and I'd like to show messages in a users inbox with relative dates. My dates are coming from MySQL Timestamps.

Next to each message I'd like to see something like "Today", "Yesterday", or "September 25, 2007". I looked into the CI datehelper, but it's not currently one of the things that are in there. Doing a quick google turned up some ugly ways of getting this, but there are issues with DST. Anyone have a solid function that achieves this result without these problems?

Cheers!
Aaron


  Reconnecting to a database after dropping it - simple question
Posted by: El Forum - 09-27-2007, 05:46 PM - Forum: Archived Development & Programming - No Replies

[eluser]LeePR[/eluser]
Hey guys,

I'm using the database utilities class to drop and recreate a database. Here are the three relevant methods in my UnitTestUtil class:

Code:
/** Drop the database. */
public function dropDatabase($database = "rsfs")     {
    if (!$this->CI->dbutil->drop_database($database)) {
        throw new RSFSException("'$database' " . $this->CI->lang->line('database_not_dropped'));
    }
}

/** Create the database. */
public function createDatabase($database = "rsfs") {
    if (!$this->CI->dbutil->create_database($database)) {
        throw new RSFSException("'$database' " . $this->CI->lang->line('database_not_created'));
    }
}


/** Load default data.*/
public function loadDefaultData() {
    $this->execute($this->strSqlPath . $this->strDefaultData);
    // ^ in a nutshell, this method just passes it to $this->CI-db->query().
}

All three methods work perfectly when run on their own however when I try to do the following:

Code:
$utils->dropDatabase();
$utils->createDatabase();
$this->CI->load->database(); // Doesn't seem to help.
$utils->loadDefaultData();

I get the following error message
Quote:Error Number: 1046

No database selected

I've tried everything - how can I reconnect to the newly created database? It's the same database that's in the config file - it connects with a call to `$utils->loadDefaultData()` the first time around, but not after dropping and recreating it.

Thanks in advance,
LeePR


  Email Problem (didnt find help on forum)
Posted by: El Forum - 09-27-2007, 04:24 PM - Forum: Archived Development & Programming - No Replies

[eluser]Ch!ps[/eluser]
This is a little bizarre problem. I looked around the forums but did not find something similar.

I have a small application in CI. Whenever the user submits a form, email is sent to the admins (more than one). I am using the email class, with mail protocol - default. The application normally does not has any problem emailing but whenever the receiver emailID is from the same domain as where the application is hosted, it gives the following error:

"Unable to send email using PHP mail(). Your server might not be configured to send mail "

In other words, if the application is hosted at http://hostingsite.com/application/ and the email recipient list includes an email-address such as [email protected], the above error is generated in the email-debugger (no one gets email, email is simply not sent). If the email recipient list does NOT include an email-address such as [email protected], no problem - email is sent.

I am using CI 1.5.4, IIS6, Windows Server 2003.

Any help would be most appreciated


  Routing issues
Posted by: El Forum - 09-27-2007, 03:55 PM - Forum: Archived Development & Programming - Replies (2)

[eluser]kilishan[/eluser]
First, yes, I have done a search and tried everything that's recommended. Nothing seems to be working for this...

I am working on a social networking site and want to have the url's take you to the user, like so: http://www.critormiss.com/username. What I have works fine right now, by going to critormiss.com/user/username. It looks up the name and performs as it should.

In my routes, The very last command is:

Code:
$route[':any'] = "user";
From what I've read, this should do it. However, when I try it out, I get the following error from Firefox (2.0.0.7):

Quote:The page isn't redirecting properly.

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

It does, however, redirect me back (after a long wait) to the default controller, which is still welcome.php for now. All of the other routing seems to be working.

I have also tried it in IE 7, but no luck. And I've tried:
Code:
$route['(.*)'] = "user/$1";

and a couple other variations.

I am on Windows Vista, using Xampp for mysql/php/apache. My htaccess file is:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|public|tmp|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Any ideas what would be causing this?

Thanks!


  Closing the page after downloading
Posted by: El Forum - 09-27-2007, 02:38 PM - Forum: Archived Development & Programming - Replies (3)

[eluser]New One[/eluser]
Hello All,

I want mi code to do this:
after pressig download - the download screen appears and in the same time previous window is closing.

controller:
function download(){
$basePath = 'c:/';
$data = file_get_contents("$basePath/instructions.txt");
$name = "instructions.txt";
force_download($name, $data);
}


view:


function GoClose()
{
//window.close();
}


&lt;?=form_open('/test/download/', $data)?&gt;
&lt;?echo '&lt;input type="image" name="submit" onmousedown = "GoClose()" src="/images/down.png" /&gt;';?&gt;
&lt;?=form_close();?&gt;


Something like this. Can someone help me?


  Removing section from URI then continuing to controller/method
Posted by: El Forum - 09-27-2007, 02:22 PM - Forum: Archived General Discussion - Replies (13)

[eluser]MikePearce[/eluser]
Hi all!

I need to append a key:value pair to my URI:

Code:
http://site.com/somecontroller/somemethod/id:1234

id:1234 could be on the end of any URI on the site (it's a replacement for the querystring). It's always going to be on the end, but I'll not know WHERE it is in the URI, so it might be
Code:
http://site.com/somecontroller/id:1234
or
http://site.com/id:1234

So, my question is, how do I remove it from the URI, process it and continue on my way?

I thought about using a pre controller hook, strip it from the URI, process it (I need to set the ID in the cookie and do some other tracking) and then set whatever variable CI needs to know which controller/method to run. When I use get_instance() in a pre-controller hook, I get nothing! Even if I did get something, I don't know what the vars are that I need.

Anyone got any ideas?

Thanks,

Mike



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