View previous topic :: View next topic |
Author |
Message |
muppie Smarty Rookie
Joined: 27 Apr 2003 Posts: 20
|
Posted: Sun Apr 27, 2003 5:04 pm Post subject: Getting smarty vars from php code |
|
|
Can this be done?
We can $smarty->assign() but can't $smarty->get()
I'm using an old version so this might have been implemented? |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Sun Apr 27, 2003 5:52 pm Post subject: |
|
|
You are probably looking for the undocumented $smarty->_tpl_vars array. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
|
Back to top |
|
Wom.bat Smarty Pro
Joined: 24 Apr 2003 Posts: 107 Location: Munich, Germany
|
Posted: Sun Apr 27, 2003 7:08 pm Post subject: |
|
|
*looking forward to php 5 and private vars* |
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Sun Apr 27, 2003 7:27 pm Post subject: |
|
|
Wom.bat wrote: | *looking forward to php 5 and private vars* |
As are we all. Personally I think in 4.3.2 they should make vars and functions that begin with _ private but thats just what I think _________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
Back to top |
|
Wom.bat Smarty Pro
Joined: 24 Apr 2003 Posts: 107 Location: Munich, Germany
|
Posted: Sun Apr 27, 2003 8:19 pm Post subject: |
|
|
no, they won't, it would screw up too much older applications
I really hope that ZE2/PHP5, with it's sophisticated features will raise the acceptance of PHP for business applications (if you don't use a f*cking application server paired with J2EE, the IT managers won't buy it)
I think of exceptions (here comes the first big laugh, zeev says developers shouldn't use them in the entire app but only "sometimes", as exceptions have memory leaks), better OO model ((de)constructors, "correct" referencing and cloning, private/public/protected, interfaces, abstract classes (mmmmh), __call/__set/__get, statics, namespaces, autoloaders) etc... it's mainly OO-related stuff, and as I like OO, I can't stand waiting for the day PHP5 is officially released (I'm still to lazy to leech a snapshot ) |
|
Back to top |
|
Tom Sommer Administrator
Joined: 16 Apr 2003 Posts: 47 Location: Denmark
|
Posted: Sun Apr 27, 2003 8:43 pm Post subject: |
|
|
Don't get PHP5 snapshot... Word has it it's leaking so much memory that it's no where near production quality yet
I'm not really looking forward to PHP5 that much, I don't see what all this namespace and inter(what's it's name) is usefull for
I heard PHP5 would make your PHP4 apps go slower... tsk
and this can't be done in PHP5:
Code: | <?php
class foo {
var $bar = NULL;
}
$foo = new foo;
$foo->bar = 'something';
|
|
|
Back to top |
|
Wom.bat Smarty Pro
Joined: 24 Apr 2003 Posts: 107 Location: Munich, Germany
|
Posted: Sun Apr 27, 2003 9:15 pm Post subject: |
|
|
eh why not, tom? |
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Sun Apr 27, 2003 9:30 pm Post subject: |
|
|
I downloaded the php5 snaps a while ago, they did leak a shitload of memory but Tom I am almost 100% sure that code would work if not it would be because PHP assumes you start in private mode unless you specify. _________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
Back to top |
|
Wom.bat Smarty Pro
Joined: 24 Apr 2003 Posts: 107 Location: Munich, Germany
|
Posted: Sun Apr 27, 2003 9:37 pm Post subject: |
|
|
I think that's what Tom was thinking, AZTEK
php assumes public mode per default |
|
Back to top |
|
Tom Sommer Administrator
Joined: 16 Apr 2003 Posts: 47 Location: Denmark
|
|
Back to top |
|
Wom.bat Smarty Pro
Joined: 24 Apr 2003 Posts: 107 Location: Munich, Germany
|
Posted: Sun Apr 27, 2003 10:12 pm Post subject: |
|
|
err, tom... I guess you didn't understand the article
THIS is not possible:
Code: | class foo
{
}
$foo = new foo;
$foo->bar = 'something'; |
|
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sun Apr 27, 2003 10:37 pm Post subject: |
|
|
that's what i read too. maybe sterling wanted to say this *won't* be possible.
both (Tom's and your example) work fine with my php4-cvs and ZE2.
me, being dumb wrote: |
anyway, it pukes at:
'require_once $this->compiler_class;' due to "unexpected T_OBJECT_OPERATOR"
and smarty has some other (fully legal php4) syntactical niftynesses here and there that could render it a good backward-compatibility-smoke-test for the php5-developers. i don't mean the stuff they documented as deprecated, i mean the parts they didn't think about
and as i wrote ">=4.0.6 and <5": this implied versions tagged as "release", of course.
noone here will give you support when smarty breaks in development version. it's always the development that's broken in the first place.
really
|
hmm, i intermixed this with another thread. sorry for disturbing. i know: i'll move along, nothing to see here... |
|
Back to top |
|
Tom Sommer Administrator
Joined: 16 Apr 2003 Posts: 47 Location: Denmark
|
Posted: Sun Apr 27, 2003 11:14 pm Post subject: |
|
|
Wom.bat wrote: | err, tom... I guess you didn't understand the article
THIS is not possible:
Code: | class foo
{
}
$foo = new foo;
$foo->bar = 'something'; |
| *Feels dumb*
BTW messju.. I assume you mean php5-CVS |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sun Apr 27, 2003 11:25 pm Post subject: |
|
|
hmm. it seems i got some things seriously wrong here. i used php4-cvs-head, but i used zend-engine2. i thought the object-related-features would more concern ze2 than the php-version that uses it. hmgrmpf. it seems i have to verify this with php5 again.
anyway: it was a cool site, that headed me to the hughes-interview 1-2 weeks ago |
|
Back to top |
|
|