Why does my call to set() do nothing?
Permalink
I posted a question on StackOverflow but didn't manage to get it answered.
http://stackoverflow.com/questions/25191921/concrete5-why-is-my-blo...
When I call an action from a block and change a member variable that change doesn't propagate to the view. It seems that's because the action is changing one instance but then a new instance of the block makes the calls to view(), on_page_view() etc.
Am I right? Am I trying to do this all wrong?
Please help me, I've wasted quite a bit of my day trying to get this working, thank you
http://stackoverflow.com/questions/25191921/concrete5-why-is-my-blo...
When I call an action from a block and change a member variable that change doesn't propagate to the view. It seems that's because the action is changing one instance but then a new instance of the block makes the calls to view(), on_page_view() etc.
Am I right? Am I trying to do this all wrong?
Please help me, I've wasted quite a bit of my day trying to get this working, thank you
Hi,
I have tried from the view method and from my action method as well, with no luck.
In fact if I do do it from the action and log it, it reads the correct value, but by the time it gets to view() the value is back to its default which is why I thought maybe its separate instances
I have tried from the view method and from my action method as well, with no luck.
In fact if I do do it from the action and log it, it reads the correct value, but by the time it gets to view() the value is back to its default which is why I thought maybe its separate instances
I've only really seen on_page_view used to inject additional scripts and and css into a page, not to set up actual block output content.
I get the impression it's kind of a special function that is more like an event hook than part of the initialisation of the block, so maybe at that point in the loading the block hasn't actually gone and initialised its object variables.
So try moving that stuff to a view function instead.