NYCPHP Meetup

NYPHP.org

[nycphp-talk] Disappearing data or I've gone mad

Jon Baer jonbaer at jonbaer.net
Wed Feb 12 11:36:15 EST 2003


I don't get where you declare data[] array to begin with.  Can you post more
code?  Id try it without the "quotes" since you don't need to interpret any
string w/ it.

- Jon

----- Original Message -----
From: "Jeremy Hise" <jhise at nextsource.com>
To: "NYPHP Talk" <talk at nyphp.org>
Sent: Wednesday, February 12, 2003 12:58 PM
Subject: [nycphp-talk] Disappearing data or I've gone mad


> Hi:
>
> I have a very strange situation that may be difficult for me to
convey...but either PHP is having problems, or I'm just a jackass.
>
> Here is the weirdo code with some of my attempt to debug. $this->data
contains an array of "keys" that need to be replaced with values. This is
kind of a ghetto template parser. Everything is fine until I get inside the
for loop (which used to be a foreach...but I'm trying everything. Inside
that loop, I cannot get $this->data[$key] to print out anything!
>
> I'm just basically looking for someone to see if I'm overlooking
something.
>
> Thanks a billion!
>
> hise
>
>      function parse() {
>         // Get an array of items such as 'first_name', 'last_name', etc
>         $kws = $this->get_tags();
>
>         // If we do have an array of keywords
>         if(is_array($kws)) {
>             // For each keyword
>             foreach($kws as $kw) {
>                 // Get the value from this object's data hasa
>                 $value = $this->data["$kw"];  // <-- this has no data in
it inside this loop
>                 // Replace the smac tagged keyword with the value
>                 $this->body = ereg_replace("<smac>".$kw."</smac>", $value,
$this->body);
>             }
>         }
>         return($this->body);
>     }
>
>
>
> --
>
> -+----------------------+
>  | jhise at nextsource.com |
>  | developer            |
>  | nextSource, Inc.     |
>  | x334                 |
>  +----------------------+
>
>
> --- Unsubscribe at http://nyphp.org/list/ ---
>
>
>




More information about the talk mailing list