🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.php
Article #230559

Re: $GLOBALS, Undefined index

#230559
From: jivanmukta
Date: Wed, 10 Sep 2014 15:21
23 lines
1949 bytes
Myślałem, że globalną. Ale może rzeczywiście jest lokalna.

Zmienna jest parametrem widoku announcement/form.php, powstaje tak (w kontrolerze, CodeIgniter):

$params['client_name'] = ...;
$this->load->view('announcement/form', $params);

Potrzebuje się do niej odwołać w helperze, zrobiłem tak (i jest źle):

function myValue($fieldName) {
    if (array_key_exists($fieldName, $GLOBALS)) {
        return $GLOBALS[$fieldName];
    } 
    $ci =& get_instance();
    $values = $ci->session->flashdata('field_values');
    if (!empty($values) && array_key_exists($fieldName, $values)) {
        return $values[$fieldName];
    }
    return FALSE;
}


Czy wiesz jak się do niej odwołać?
Technical Details
Message-ID: <bc2d910e-60f6-4200-ba07-89a563222730@googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!news.glorb.com!r2no18265713igi.0!news-out.google.com!q8ni0qal.1!nntp.google.com!m5no90477qaj.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
References: <fd339485-358a-4935-af62-89aaa8a646ad@googlegroups.com> <541064ac$0$26848$65785112@news.neostrada.pl>

Show Full Headers
Complete Article Headers
X-Received: by 10.66.190.67 with SMTP id go3mr25932918pac.10.1410362465646;        Wed, 10 Sep 2014 08:21:05 -0700 (PDT)
X-Received: by 10.140.94.178 with SMTP id g47mr12836qge.29.1410362465595; Wed, 10 Sep 2014 08:21:05 -0700 (PDT)
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!news.glorb.com!r2no18265713igi.0!news-out.google.com!q8ni0qal.1!nntp.google.com!m5no90477qaj.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: pl.comp.lang.php
Date: Wed, 10 Sep 2014 08:21:05 -0700 (PDT)
In-Reply-To: <541064ac$0$26848$65785112@news.neostrada.pl>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=83.31.200.199; posting-account=Fd8BNwoAAACl8PCi6-fI0bkHGOgt6LMa
NNTP-Posting-Host: 83.31.200.199
References: <fd339485-358a-4935-af62-89aaa8a646ad@googlegroups.com> <541064ac$0$26848$65785112@news.neostrada.pl>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bc2d910e-60f6-4200-ba07-89a563222730@googlegroups.com>
Subject: Re: $GLOBALS, Undefined index
From: jivanmukta@poczta.onet.pl
Injection-Date: Wed, 10 Sep 2014 15:21:05 +0000
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit