extendPageType For Nested Pages
Permalink
Hi,
I've been trying to prevent nested pages based upon Jordan's tutorial on:
http://c5cookbook.com/recipes/prevent_nested_pages...
However the on_page_add function doesn't seem to be working. For example, I've tried adding a table entry as a test:
In site_events.php:
In controllers/page_types/page.php:
I've run this test a few different ways and it doesn't seem to create any entry in the database. (Concrete 5.4.1.1)
(Alternatively, running:
Seems to work, just how to pass the $page variable to find the parent page's cID.)
Anyone got any ideas why this is failing for extendPageType?
I've been trying to prevent nested pages based upon Jordan's tutorial on:
http://c5cookbook.com/recipes/prevent_nested_pages...
However the on_page_add function doesn't seem to be working. For example, I've tried adding a table entry as a test:
In site_events.php:
<?php Events::extendPageType('page', 'on_page_add'); ?>
In controllers/page_types/page.php:
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); class on_page_add extends Controller { function on_page_add() { $ql = "INSERT INTO testtable (cid) VALUES (955)"; mysql_query($ql); } } ?>
I've run this test a few different ways and it doesn't seem to create any entry in the database. (Concrete 5.4.1.1)
(Alternatively, running:
Events::extend($event, $class, $method, $filename, $param);
Seems to work, just how to pass the $page variable to find the parent page's cID.)
Anyone got any ideas why this is failing for extendPageType?