Welcome Guest, Not a member yet? Register   Sign In
  Is the helper function can't use another param variable which aren't defined in the function name?
Posted by: El Forum - 08-30-2007, 09:48 AM - No Replies

[eluser]OneCorea[/eluser]
$this->load->helper('myhelper');

in myhelper.php file

Code:
// if blank string returns 1
function is_blank($str){
    $temp=str_replace("\n","",$str);
    $check=0;
    for($i=0;$i<strlen($temp);$i++)
    {
     if($temp[$i]=="<") $check=1;
     if(!$check) $temp2.=$temp[$i];
     if($temp[$i]==">") $check=0;
    }
    if(eregi("[^[:space:]]",$temp2)) return 0;
    return 1;
}

when I try to this my own helper function CI displays error as belows..

Code:
Message: Undefined variable: temp

temp, temp2 is not param which is defined function name parameter..

What is wrong????


  Problem with loading model !
Posted by: El Forum - 08-30-2007, 09:41 AM - No Replies

[eluser]m_drago85@yahoo.com[/eluser]
Hy all. I`m new to this forum even thought i use code igniter for some time now.
I have a very big problem :down:
This happens when trying to load a model from a controller

in my constructor i have :
parent::Controller();
$this -> load -> model('hosting_model','hosting',TRUE);
$this -> hosting_1 = $this->load->database('hosting',TRUE);


in function index i have:

$ext_name='.ro';
$x = $this->hosting->is_ext_unique($ext_name);


The error is :

Call to undefined method CI_DB_mysql_driver::is_ext_unique()

It doesn`t get tot the function in model because i put die in there and nothing happens...
I don`t know what to do...

In my model in constructor i have :

parent::Model();
$this->hosting = $this->load->database('hosting',TRUE);


i connect to my database in database.php from config .. here are the detailes

$db['hosting']['hostname'] = "localhost";
$db['hosting']['username'] = "Dragos";
$db['hosting']['password'] = "jught";
$db['hosting']['database'] = "hosting";
$db['hosting']['dbdriver'] = "mysql";
$db['hosting']['dbprefix'] = "";
$db['hosting']['active_r'] = TRUE;
$db['hosting']['pconnect'] = FALSE;
$db['hosting']['db_debug'] = TRUE;


... :roll:


  Parse Email Templates
Posted by: El Forum - 08-30-2007, 09:28 AM - No Replies

[eluser]Unknown[/eluser]
Has anyone developed a email template helper.

Ideally it would an email template e.g.

Dear {name},

You new username and password are:

{username}
{password}

Regards,

Admin

--

And would swap out the {variables} for supplied ones.

Cheers,

Chris.


  problem whith connecting admin and main controllers
Posted by: El Forum - 08-30-2007, 09:19 AM - No Replies

[eluser]erjakrobaczek[/eluser]
Hello, I'm just started to learn CI and have found problem, which I have no idea what to do. I suppose it is very easy, but I don't feel good in CI now and it took me a lot of time.

The problem is:
I have a main controller in which I have my start page with news etc, also have an admin controller, where I can login to admin panel and manage the page.
When I'm using /admin path in right menu I have login form or info that I'm login, it's great. But when I'm going back to main page, so I'm using main controller there is a problem - I don't know how to use in these case function to check login from admin controller in it. I have tried to copy the function, but I'm sure that it's very stupid idea. How should I defend it?


  DomPDF help!!
Posted by: El Forum - 08-30-2007, 08:54 AM - No Replies

[eluser]andregufc[/eluser]
I'm from Portugal, and i can't speack english, my english is not good, but please help me.

I have a form with results of a search, and have one checkbox for each result.

If I select more of 5 results, the pdf not display.

My code:

*************************************************
$this->load->plugin('to_pdf');
$sql='WHERE';
foreach($_POST['opcoes'] as $selecionados){
$sql .= ' Imo_Codigo=\''.$selecionados.'\' OR ';
}
$dados['results'] = $this->db->query('SELECT * FROM Imovel '.$sql.'Imo_Codigo = \'FINALIZA_OR\'');
$html = $this->load->view('cadimobiliario_modoficha', $dados, true);
pdf_create($html, 'Pesquisa Imovel', 'landscape');

*************************************************

if i select 1,2,3,4 or 5 results, the pdf is displayed ok.

Whats the problem? Performance? DomPDF? My Code?

Thx very much!


  get wrong url in form and links
Posted by: El Forum - 08-30-2007, 08:32 AM - No Replies

[eluser]Unknown[/eluser]
hey, I have to admit that I'm totally new to CodeIgniter and decided to start following those tutorials videos that can be found on CodeIgniter webpage.

But there is a one small thing that I just can't get to work:

in the "blog" tutorial everything works perfekt at the first page where it lists all the blogs that exist in the database, that's great, then I click on "comment" at any of the blog and that direct me to the right page (http://localhost/codeigniter_1.5.4/index...comments/1).

But if I try to submit a comment or even try to add link on the comment page then I always get some wrong url in the addressbar:

f.ex.

I want to submit a comment, then I use: &lt;?=form_open('blog/comment_insert');?&gt; ......
but the page I'm then submittet to is

http://localhost/codeigniter_1.5.4/index...ent_insert

instead of

http://localhost/codeigniter_1.5.4/index...ent_insert

Can anyone help me with this one ?


  SOLVED: xmlrpc blues
Posted by: El Forum - 08-30-2007, 07:35 AM - No Replies

[eluser]alexsancho[/eluser]
Hi, I'm finishing an Image gallery based on CI, it's just a port of MT Photo Gallery Templates, but i need some help to finish it.

I've added an XMLRPC interface based on metaweblog, to allow desktop publishing, that works really well except for file transfers.

This is the relevant part of code that writes the file locally, nothing special as you can see, but every image i try to transfer is corrupted.

Code:
$data = $parameters['3'];
        $name = preg_replace("/\s+/", "_", $data['name']);
    $type = $data['type'];
    $bits = $data['bits'];
        
        log_message('debug','(MW) Received '.strlen($bits).' bytes');
    
        $localpath = './thumbs/'.$name;
        if(!is_dir(dirname($localpath))) {
            @mkdir(dirname($localpath));
        } else if(file_exists($localpath)) {
            @unlink($localpath);
        }

        /* encode & write data (binary) */
    $ifp = fopen($localpath, 'wb');
    $success = fwrite($ifp, $bits, strlen($bits));
    fclose($ifp);

    @chmod($localpath, 0777);

Not really sure if this is a CI issue, but i like to know if anyone has a similar function working.

thanks in advance

UPDATE: Seems that i've catched the problem. CI doesn't decode properly binary data. If i remove 'base64_decode' from xmlrpc library and decode the variable later, inside controller, all works fine.

Maybe anyone can check this to confirm if there's a bug in xmlrpc library.

There's another problem with xmrpcs library, with PHP 5 i need to modify the "parseRequest" method in this way to make it work:

Code:
function parseRequest($data='')
    {
        global $HTTP_RAW_POST_DATA;
        
        //-------------------------------------
        //  Get Data
        //-------------------------------------

        if ($data == '')
        {
            if ( !isset( $HTTP_RAW_POST_DATA ) ) {
                   $HTTP_RAW_POST_DATA = file_get_contents("php://input");
            }
            $data = $HTTP_RAW_POST_DATA;
        }
    ...
    }

Hopes this will be fixed in future releases


  Validation callbacks with model methods
Posted by: El Forum - 08-30-2007, 05:59 AM - No Replies

[eluser]feri_soft[/eluser]
How to do a validation callback function when my validation function used for the callback is not in the controller as in the demo but in a model? Whats the syntax if thats possible. I know i can call it in a new controller function and do the rest as described but isnt there a direct way of making it? Thanks!


  unset_userdata
Posted by: El Forum - 08-30-2007, 05:16 AM - No Replies

[eluser]Colin Carter[/eluser]
Hello,

I'm not sure if I'm using unset_userdata() properly, but if I wanted to unset a number of session variables using an array unset_userdata() doesn't work.

For example:

Code:
$this->session->unset_userdata(array('name', 'data'));

doesn't unset the 'name' and 'data' session variables. This is, I believe, due to the line in unset_userdata() unsetting based on an array key not its value.

Code:
unset($this->userdata[$key]);

if I'm using unset_userdata() incorrectly please could you let me know how to use it. I read that it's been documented in svn but I couldn't find how to check it out.

Many thanks


  Controllers in sub-folder
Posted by: El Forum - 08-30-2007, 05:11 AM - No Replies

[eluser]Nikhil Vijayan[/eluser]
I am now creating a website with member side and admin side using ci.

I created a folder called admin in the controllers folder.

Then created a controller named members inside the admin folder to view/edit/delete members.

The default index function is working when i access

Quote:http://site/admin/members

but when i call the member function view

Quote:http://site/admin/members/view

i am getting a 404 Page not Found error.

Anybody please help to solve this problem.


Quote:I Corrected it. The View function was renamed to View2 . This made it work properly
Is this view function a reserved or something... ???


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

Username
  

Password
  





Latest Threads
Update from 4.6.0 to 4.6....
by captain-sensible
7 hours ago
Ajax post failing with Ty...
by vitnibel
Yesterday, 08:52 PM
MVC vs MVCS vs CodeIgnite...
by FlavioSuar
Yesterday, 10:33 AM
CodeIgniter Shield 1.0.0 ...
by timesprayer
Yesterday, 05:22 AM
Website Traffic Drop Afte...
by InsiteFX
Yesterday, 04:23 AM
Magic login link not work...
by InsiteFX
Yesterday, 04:16 AM
Is codeigniter 5 upco...
by InsiteFX
Yesterday, 04:10 AM
CI4 Auto-Discovery not wo...
by InsiteFX
05-09-2025, 11:04 PM
Why PHP is still worth le...
by InsiteFX
05-09-2025, 10:55 PM
Any user guid or video o...
by msnisha
05-09-2025, 02:30 PM

Forum Statistics
» Members: 145,300
» Latest member: twitframecom4
» Forum threads: 78,386
» Forum posts: 379,436

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB