Opened 11 years ago

Closed 10 years ago

#459 closed new feature (fixed)

RoxGenericPage - $Page object in controllers

Reported by: lemon-head Owned by: lemon-head
Priority: major Milestone: Rox Framework
Component: FrameWork Keywords:
Cc:

Description

With the class RoxGenericPage?, the $Page object in our controllers will no longer be a global variable, but a local one, and rendering will happen inside the controller. This way we reduce dependencies on global state, and make our applications more independent.

This is a hybrid solution between the #436 RoxPageView scheme and the old MyTB scheme, and is more or less compatible with both.

$Page object in old MyTB scheme

The page object was obtained as a global object by

$Page = PVars::getObj('page');

Then the controller set attributes of that object:

$Page->teaser = 'this is the teaser';

Finally, in page.php, these global variables are inserted in the page html.

$page object in RoxGenericPage? scheme

The page object is created as a local object by

$page = new RoxGenericPage();

Then the controller set attributes of that object:

$page->teaser = 'this is the teaser';

Finally, in the controller, the render() function is called on that local object.

$page->render();

For now, the $page->render() will do nothing but call the page.php template. Maybe it will do this another way later. Anyway, the applications don't have to care about how the $page object does the rendering.

Change History (4)

comment:1 Changed 11 years ago by lemon-head

  • follow_up changed from none to review code
  • Owner set to lemon-head
  • Status changed from new to assigned

[4338] - RoxGenericPage? is online.

comment:2 Changed 11 years ago by lemon-head

This class is now called "PageWithParameterizedRoxLayout?". Which describes exactly what it is :)

(the parameters being injected by "$page->title = ..." etc.

comment:3 Changed 11 years ago by lemon-head

  • Milestone changed from unassigned to Rox Framework

comment:4 Changed 10 years ago by lemon-head

  • follow_up changed from review code to none
  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.