Welcome Guest, Not a member yet? Register   Sign In
  CI Email Help
Posted by: El Forum - 10-12-2007, 04:25 PM - No Replies

[eluser]Unknown[/eluser]
Hi All,
Recently I'm developing an application for a client and I used CI's default Email library to do the email sending, it works fine but one thing comes up, some of the staffs in the client's company see an "encoded" email in their mailbox. I'm not sure if this related to some configuration of the Email class. The email sort of look like:
SVM45MZ76MYUT4TRE76...
How do I use the CI Email class correctly so that this issue can be fixed?
Thank you very much for your help.

With my best,
Jim


  class Dashboard extends API
Posted by: El Forum - 10-12-2007, 01:58 PM - No Replies

[eluser]jkevinburton[/eluser]
I want to create a library class called API which should extends the Controller.
So when I create controllers, all I have to do is say:

Code:
class Dashboard extends API {
     function Dashboard() {
             parent::API();
     }
}

I autoloaded the api class.. but when I ran the controller, it told me that API class didn't exist.....

any insight?

Kevin


  wordpress url / CI uri
Posted by: El Forum - 10-12-2007, 01:30 PM - No Replies

[eluser]AlexC33[/eluser]
Hello everyone Smile

I'm new to CI, and new to WP also. I just got involved in a large project that make extensive use of CI (in fact, all the project use CI... Except the WP part), with a postgresql DB.

I need to make WP work inside the site in CI. I need in particuliar that the url of WP are not touched / interpreted by CI. Is there a magic way (which I don't know) to do this? Or do I have to ask the managers here to drop WP (it's a sweet dream, but I don't think it's a realistic one)?

thanks for your help Smile

PS: I know it has already been asked here CodeIgniter with Wordpress ? , but the thread is pretty old, and has no answers...


  search as a hash
Posted by: El Forum - 10-12-2007, 01:24 PM - No Replies

[eluser]thurting[/eluser]
Hi,

I notice that the search feature on this forum seem to store the queries in a hash table and present the hash in the result URL. I was wondering if anyone could give me insight into why this is done? Thanks.


  Validation function in helper
Posted by: El Forum - 10-12-2007, 09:10 AM - No Replies

[eluser]Unknown[/eluser]
Hi there,

I'm actually doing a form library so i can easily build some forms in CI. I'm having different type of fields (ie: date, select, checkbox etc.) and i want to automatically do some validation using the CI library on these types of field. For example if i have a date field i want to automatically validate the field to check if it's a true date.

As i'm doing that in a library i thought it would be nice to have these validation functions (is_true_date($date) or whatever) in a validation helper. What do you think of that idea ?

Anyway i was trying to do that but couldn't find a way to make it work. I've been using the validation form from the documentation and just moved the username_check($str) function in a helper. I also removed the "callback_" part in the validation string as it's gonna be used as a standard function (such as is_numeric).

I had to change a little bit the username_check($str) function in the helper (to get the instance into the function). Here is how it looks like now :

Code:
function username_check($str)
{
  if ($str == 'test')
  {
    if (!isset($this->CI))
      $this->CI =& get_instance();
    $this->CI->validation->set_message('username_check', 'The %s field can not be the word "test"');
    return FALSE;
  }
  else
  {
    return TRUE;
  }
}

The problem i'm having now is that if it try to validate the form and an error occurs the username field is filled up with what's returned by username_check($str) (1 or 0) instead of its original value. Do you have any idea why ? Shouldn't it work as if i was using is_numeric or any other function ?

Thanks for your time.


  Increment field with ActiveRecord
Posted by: El Forum - 10-12-2007, 07:51 AM - No Replies

[eluser]Alex007[/eluser]
It seems that with ActiveRecord it is impossible to increment the value of a field without fetching it first.

Here's what I'd like to do:

Code:
$this->db->where('ThreadId', $ThreadId);
$this->db->set('ViewCount = ViewCount + 1');
$this->db->update('Forum_Threads');
But that doesn't work, the resulting query looks something like this:
Code:
UPDATE Forum_Threads SET 'ViewCount = ViewCount + 1' = '' WHERE ThreadId = 1

Is there anyway, with ActiveRecord, to increment a field, without fetching it's value first ? I don't need to know the value at all, so SELECTing it first would be a waste of resources.

Do I have to resort to simple_query() ?


  Can someone please explain this to me
Posted by: El Forum - 10-12-2007, 06:28 AM - No Replies

[eluser]bosco500[/eluser]
Can someone please explain this code to me? I was browsing through the design on the freakauth_demo, trying to understand the design. This line of code is from menu.php (view)

Code:
<?php $ci_uri = trim($this->uri->uri_string(), '/'); $att = ' id="active"';?>
    <ul id="navlist">
        <li&lt;?= $ci_uri == ''? $att: ''?&gt;>&lt;?=anchor('', 'home')?&gt;</li>
        <li&lt;?= substr($ci_uri, 0, 7) == 'example'? $att: ''?&gt;>&lt;?=anchor('example', 'examples')?&gt;</li>
        <li&lt;?= $ci_uri == $this->config->item('FAL_login_uri')? $att: ''?&gt;>&lt;?=anchor($this->config->item('FAL_login_uri'), 'login')?&gt;</li>
        <li&lt;?= $ci_uri == $this->config->item('FAL_register_uri')? $att: ''?&gt;>&lt;?=anchor($this->config->item('FAL_register_uri'), 'register')?&gt;</li>
        <li&lt;?= $ci_uri == $this->config->item('FAL_forgottenPassword_uri')? $att: ''?&gt;>&lt;?=anchor($this->config->item('FAL_forgottenPassword_uri'), 'forgotten password')?&gt;</li>
        <li&lt;?= $ci_uri == $this->config->item('FAL_changePassword_uri')? $att: ''?&gt;>&lt;?=anchor($this->config->item('FAL_changePassword_uri'), 'change password')?&gt;</li>
        <li&lt;?= substr($ci_uri, 0, 5) == 'admin'? $att: ''?&gt;>&lt;?=anchor('admin', 'admin')?&gt;</li>
    </ul>

Why does every <li> have
Code:
&lt;?= $ci_uri == $this->config->item('FAL_login_uri')? $att: ''?&gt;>&lt;?=anchor($this->config->item('FAL_login_uri'), 'login')?&gt;

I realize that $ci_uri is an object being set, but what is the ? $att: '' for? Also why is substr used?

Thanks for the help!


  Unlimited nested folders in controller
Posted by: El Forum - 10-12-2007, 04:41 AM - No Replies

[eluser]Unknown[/eluser]
NOTE
This intend to modify the CI_router core class (CI 1.5.4),
so if you do not want to, please skip this.


in libraries/Router
CI_class
modify the _validate_segments function
replace line 200 with this code

Code:
if (file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT))

replace line 206 with this code
Code:
if (is_dir(APPPATH.'controllers/'.$this->fetch_directory().$segments[0]))

replace line 215 with this code
Code:
if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT) && !
is_dir(APPPATH.'controllers/'.$this->fetch_directory().$segments[0]))

insert this code after line 218
Code:
$segments = $this->_validate_segments($segments);


finally modify set_directory function to this

Code:
$this->directory .= $dir.'/';

-----------edit
Actually not finally yet, My bad, sorry.
go to system\codeigniter\codeigniter.php

modify this code ~line 216
Code:
////ORIGINAL

call_user_func_array(array(&$CI, $method), array_slice($RTR->rsegments, (($RTR-
>fetch_directory() == '') ? 2 : 3)));    



///// REPLACE WITH THIS

$num_arg = preg_match_all("|/|", $RTR->fetch_directory(), $tmp) + 2;
unset($tmp);
call_user_func_array(array(&$CI, $method), array_slice($RTR->rsegments,$num_arg));


Good luck.


  xml-rpc: blogger api question
Posted by: El Forum - 10-12-2007, 03:49 AM - No Replies

[eluser]gerben[/eluser]
I'd like to add an xml-rpc interface to my system, using the blogger api. There isn't much documentation or discussion about this, but I thought I'd give it a try.

I debug the code using xml-rpc client Ecto on osx, and when I connect the client sends a request for blogger.getUsersBlogs, and my server returns the expected response.

Normally though, after that a request is sent for blogger.getRecentPosts and blogger.getUserInfo, but the client doesn't do this in my case. The progress bar just keeps on spinning forever, but in the console I can see that no further request to the server is sent.

My guess would be that either: something in the first response doesn't meet the client's "expectations", or somethings's wrong with my blogger.getRecentPosts method handling.

Below is my code, based on the example in the CI manual. For testing purposes I've commented out the user-authentication part, and added some dummy-data. any thoughts on what the problem could be are very welcome, because I feel it must be something small and silly.


Code:
function index()
    {
    
    
        $this->load->library('xmlrpc');
        $this->load->library('xmlrpcs');
        
        
        $config['functions']['blogger.getUsersBlogs'] = array('function' => 'Server.getUserBlogs');
        $config['functions']['blogger.getRecentPosts'] = array('function' => 'Server.getRecentPosts');
        $config['functions']['blogger.getUserInfo'] = array('function' => 'Server.getUserInfo');
        
        
        $this->xmlrpcs->initialize($config);
        $this->xmlrpcs->serve();
    }
    
  
    
    
    function getUserInfo($request)
    {
    
            $username = 'smitty';
            $password = 'smitty';
    
            $this->load->library('xmlrpc');
        
            $parameters = $request->output_parameters();
      
            
        
            $response = array(array('nickname'  => array('Smitty','string'),
                                    'userid'    => array('99','int'),
                                    'url'       => array('http://yoursite.com','string'),
                                    'email'     => array('[email protected]','string'),
                                    'lastname'  => array('Smith','string'),
                                    'firstname' => array('John','string')
                                    ),
                             'struct');
    
            return $this->xmlrpc->send_response($response);
            
        

    }
    
    
    function getUserBlogs($request)
    {
    
            $username = 'smitty';
            $password = 'smitty';
    
            $this->load->library('xmlrpc');
        
        
            $response = array(array(
            'isAdmin' => array('1', 'int'),
            'url'  => array('http://yoursite.com','string'),
                                    'blogName'    => array('My Blog','string'),
                                    'blogid'       => array('1','int'),
                                    'xmlrpc' => array('http://www.zomp.nl/server','string')
                                    
                                    ),
                             'struct');
    
            return $this->xmlrpc->send_response($response);
            
        

    }
    
    
    function getRecentPosts($request)
    {
    
            $username = 'smitty';
            $password = 'smitty';
    
            $this->load->library('xmlrpc');
        
        
            $parameters = $request->output_parameters();
        
        
            $response = array(array('link'  => array('http://yoursite.com','string'),
                                    'permaLink'    => array('http://zomp.nl/zomplog','string'),
                                    'userid'       => array('123','int'),
                                    'mt_allow_pings'     => array('0','int'),
                                    'mt_allow_comments'     => array('1','int'),
                                    'description'    => array('bla bla','string'),
                                    'mt_convert_breaks'    => array('__default__','string'),
                                    'postid'    => array('1234','int'),
                                    'mt_excerpt'    => array('lala','string'),
                                    'mt_keywords'    => array('lala','string'),
                                    'title'    => array('This is my post','string'),
                                    'mt_text_more'    => array('lalili','string'),
                                    'dateCreated'  => array('2005-12-13T01:35:00Z','dateTime.iso8601')
                                    ),
                             'struct');
    
            return $this->xmlrpc->send_response($response);
            
        

    }


  Function that checks if a segment key exists ?
Posted by: El Forum - 10-12-2007, 02:12 AM - No Replies

[eluser]starbbs[/eluser]
Call me stupid but i need a function that simply returns the key if this key exists inside the URI class. I cannot seem to fin it. Let me explain:

Code:
/**
*   This returns true, even is the segment does NOT exist. Example:
*
*    $segment = array( 1 => 'cpanel',
*                      2 => 'admin',
*                      3 => 'module',
*                      4 => 'user',
*                      5 => '44');
*/

  // In my code, i use this to get the value:
  $segVal = $this->uri->segment(6, 0);

  // If all goes well, $segVal contains FALSE. but when i do:
  $segVal = (is_numeric($this->uri->segment(6, 0)) ? TRUE : FALSE;

  // Now segVal contains TRUE !

So, i was thinking that there might be a function, in where i can check for a key directly. But i cannot find this function. I created my own function. Maybe someone can think of a faster way:

Code:
// $name = the name of the segment you want to check
    // $return_index = When set to true, it returns the index of $name
    //                 When set to false, it returns $name when found
    // result: when found, the name or it's key, when nothing is found, it returns false
    
    function nsegment($name, $return_index = FALSE )
    {          
       if( in_array( $name, array_values($this->router->segments)))
       {
            foreach($this->router->segments as $segmentidx => $value ) {
                if($name == $value) {
                 if($return_index){
                  return $segmentidx;
                  }else return $value;
                }
            }
       }else
         return FALSE;
    }
     /* $cpanelidx contains '3' */
    $cpanelidx = $this->CI->uri->segmentn('module', TRUE);  
  
    /* $cpanel contains 'module' */
    $cpanel = $this->uri->nsegment('module');

If you have any suggestion for my problem, please reply!

Thnks @


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

Username
  

Password
  





Latest Threads
Setting baseURL in Regist...
by michalsn
2 hours ago
Update from 4.6.0 to 4.6....
by FlavioSuar
Yesterday, 04:17 AM
Sessions old files are de...
by InsiteFX
05-12-2025, 10:30 PM
Ajax post failing with Ty...
by PaulC
05-12-2025, 12:23 AM
intermittent smtp failure...
by InsiteFX
05-11-2025, 11:30 PM
MVC vs MVCS vs CodeIgnite...
by FlavioSuar
05-10-2025, 10:33 AM
CodeIgniter Shield 1.0.0 ...
by timesprayer
05-10-2025, 05:22 AM
Website Traffic Drop Afte...
by InsiteFX
05-10-2025, 04:23 AM
Magic login link not work...
by InsiteFX
05-10-2025, 04:16 AM
Is codeigniter 5 upco...
by InsiteFX
05-10-2025, 04:10 AM

Forum Statistics
» Members: 145,872
» Latest member: mu88uknet
» Forum threads: 78,388
» Forum posts: 379,448

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB