Martin Atkins (mart) wrote in fotobilder,
Martin Atkins

core1.s2 proposals: Functionize page components

Right now, all of the content for each page is mostly generated by one function: the print_body() method of the relevant Page subclass.

We need to abstract everything out into functions. For example,

function GalleryPage::printBody() {
function GalleryPage::print_page_navigation() {
  if ($.pages.alldisplayed != true) {
    itemrange_skiplinks($.pages, $this->page_location());
function GalleryPage::page_location() : string {
  return "Page $.pages.current of $";
function GalleryPage::print_gallery() {
    # ... some implementation of printing out a bunch of images

What are the benefits of this separation? Customization, primarily. Componentizing destinct parts of the output makes it far easier for the higher layers to swap bits around without having to rewrite everything. If I don't like the way my selected layout has implemented the navigation skiplinks, I can simply override itemrange_skiplinks(). If my selected layout only puts skiplinks at the bottom and I want them at the top too, I can just override GalleryPage::print_body().

Obviously the same would be done for similar distinct components on other views. IndexPage already has a distinct function for printing the gallery links, but PicturePage could do with separating the output of the image from the output of the navigation links, title, metadata and so forth. (We don't actually have titles and metadata available yet, but they should be available eventually.)


  • 302: lj_dev

    In the interests of consolidating all FotoBilder development-related discussion, we're going to be closing down this community. The same…

  • Development stalled?

    Is the development of Fotobilder held? Stalled? I am asking because there is no activity on the community and there is no link to the Fotobilder…

  • (no subject)

    Does FotoBilder works with Apache2? I installed all the required modules on my debian sarge, and when I restart my apache server, it dies horribly…

  • Post a new comment


    Comments allowed for members only

    Anonymous comments are disabled in this journal

    default userpic