I am using a CCK (Seblod) that extends com_content and allows adding complex fields, like PHP code to be run on onBeforeRender event.
I need to change the values of some attribs
of an article in the article view, specifically set show_title
to 0 to hide native Joomla title and replace it with a custom field, and I am trying to to that through this php field attached to before render event.
I have checked that in this before render context, I cannot access the $this
object (it gives me the classical error "Using $this when not in object context"), but I can access current article via
$article = JTable::getInstance("content");
$article->load($id);
where the $id
is taken from JInput. I have also seen that I can read the show_title
value in the JSON value retrieved with $article->attribs
.
But, as a beginner Joomla developer, I cannot find a way to change that value. Just to be clear: I don't want to change it in the DB (for which I have read I should use JTable->store), I need to change it in the before render so that native Joomla title is not displayed.
$article->attribs->set...
of course does not work since $article->attribs
is just a string... but also maybe JTable is not the correct way to do that because it maps to the db...
Is it possible to do that in this context (no access to $this)?
var_dump(ob_get_contents())
and I get a sadNULL string(0) "
BTW, I never used ob_get_contents so now I am going to search around..