site_post.php seems permanently cached ?? Deleted it, cleared cache, etc.

Permalink
Okay, tried to add a block programmatically as decribed in this thread:

http://www.concrete5.org/community/forums/customizing_c5/programmat...

$page = Page::getByID($pid);
$block = BlockType::getByHandle('some_block');
//set block data (differs for each block type... following is an example for the 'content' type)
$data = array(
    'content' => '<p>test</p>',
);
$page->addBlock($block, 'Area Name', $data);


I added the above code to config/site_post.php and what happened was every time I visited the page a new instance of the block was created on that page.

That's not how it should work. Right? What would be the point of that?

 
zoinks replied on at Permalink Best Answer Reply
(JordanLev has answered me elsewhere... the above code works correctly by creating a new instance every time the page is loaded since config/site_post.php executes every time the page is loaded... So, the 'add a block code' should go somewhere else, I guess, if you want to add a block programmatically only once; I think Jordan said the only time he ever uses it is on a package installer... )

this thread can be deleted if someone wants to delete it!