Re: need help! i cant get this object variable working!

From: Date: Wed, 28 Apr 2004 12:53:33 +0000
Subject: Re: need help! i cant get this object variable working!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-184866@lists.php.net to get a copy of this message
Hi, Wednesday, April 28, 2004, 10:22:20 PM, you wrote: AF> I am having a problem with my template system that takes AF> variables embedded in templates such as {STYLE_DIR} and replaces AF> them with php variables "theme/thestyledir". AF> The problem is this is only half working and variables in the AF> template such as {row[n_title]} which ill use as an example will AF> not be replaced. I know where the problem is i just don't know how AF> to fix it. AF> The problem is in my theme class: AF> http://zeaus.wtfux.com/pcm/includes/theme.sphp AF> in my news class i have this code: while ($style->>row = mysql_fetch_array($query)) AF> { AF> $content = "$content". AF> $style->get_page_new(TEMP_NEWS_HEADLINE); AF> } AF> this calls get_page_new which replaces the tags using the function variable_buffer.. AF> My problem is that in my theme class $this->row will not AF> print any information in the variable_buffer class. But it will in AF> get_page_new. AF> I know my variable_buffer function works because i have AF> tested it by putting $this->row[n_title]="blah" at the top of AF> variable_buffer. Also this code: AF> $var = @constant($string[1]); AF> works great too. AF> The only thing that i can see which could possibly be wrong AF> with it is that i am either calling the variable up wrongly ( AF> $this->row[n_title] ) or it has some thing to do with AF> preg_replace_callback() in get_page_vars in my theme class.. AF> I have tryed searching for preg_replace_callback() but i couldnt find anything.. AF> Please please please does anyone know why my class variable AF> $row will not allow information be passed to the function variable AF> buffer? This is driving me cazy! lol AF> --------------------------------- AF> Yahoo! Messenger - Communicate instantly..."Ping" your AF> friends today! Download Messenger Now try changing theme to $this as: $tpl = preg_replace_callback("#\{([a-z0-9\-_\[\]]*?)\}#is",array($this, 'variable_buffer'), $tpl); -- regards, Tom

« previous php.general (#184866) next »