What is var $pobj? Shows up in many blocks here but doesn't seem to do anything.
Permalink 1 user found helpful
At the top of many blocks that I have looked at from here there is a variable by the name of $pobj.
Am just wondering what it is, what it does, and if just sits there doing nothing...if it is safe to remove it.
I hate extraneous variables from who knows where sitting around. Just a pet peeve of mine.
Carlos
Am just wondering what it is, what it does, and if just sits there doing nothing...if it is safe to remove it.
I hate extraneous variables from who knows where sitting around. Just a pet peeve of mine.
Carlos
Thanks ChadStrat!
Since it does not appear to be used in the controller I am working on (a variation of one whose code I have modeled mine after...thus the presence of pobj) I assume that it's okay to remove it?
When I try and print it out it doesn't seem to have any value to it at all. It just seems to be a variable declaration without initialization of any kind.
Carlos
Since it does not appear to be used in the controller I am working on (a variation of one whose code I have modeled mine after...thus the presence of pobj) I assume that it's okay to remove it?
When I try and print it out it doesn't seem to have any value to it at all. It just seems to be a variable declaration without initialization of any kind.
Carlos
It's actually not. $c is typically the page object, but $pobj (when found in a block controller) is just legacy cruft from previous versions of concrete5. It can be discarded when found as var $pobj.
Thanks Andrew!
The person who wrote the block I was studying must have copied it over from some other legacy block code just like I copied their use of that var into mine (thinking it had some use).
I'll remove it.
I am finally beginning to see the power of C5 and have created something like 4 or 5 blocks to make the life of one of my clients much easier. This block building business is turning out to be pretty nifty!
Carlos
The person who wrote the block I was studying must have copied it over from some other legacy block code just like I copied their use of that var into mine (thinking it had some use).
I'll remove it.
I am finally beginning to see the power of C5 and have created something like 4 or 5 blocks to make the life of one of my clients much easier. This block building business is turning out to be pretty nifty!
Carlos
Unfortunately that var $pobj thing was (still is?) in the "bare bones block" example that the block creating tutorial uses. Another place where the "documentation" needs some serious updating. I didn't realize that was unnecessary for over a year! It's still in a bunch of my older code, I kind of cringe when I see it :)
-Jordan
-Jordan
I didn't even realize that it was in the block example in the documentation tutorial. I took a look at that example code and it was so...well...simplistic that it turned out to be less than desirable to helping me build blocks.
I've mostly used your excellent and free blocks Jordan, as a base of code from which to learn to build my own (thanks very much for those!).
Now that you mention it...I think the block of yours that I saw it in was the FancyBox block if I am not mistaken.
No biggie. I just didn't know what that strange looking variable was. Now I know :).
Carlos
I've mostly used your excellent and free blocks Jordan, as a base of code from which to learn to build my own (thanks very much for those!).
Now that you mention it...I think the block of yours that I saw it in was the FancyBox block if I am not mistaken.
No biggie. I just didn't know what that strange looking variable was. Now I know :).
Carlos
Some addons pass that var as an instance within the controller to make sure it's available.
ChadStrat