SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Spirit Coder allspiritseve's Avatar
    Join Date
    Dec 2002
    Location
    Ann Arbor, MI (USA)
    Posts
    648
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Composite view gotchas

    Up until now, most of my views have been fairly simple, just placing a custom page template inside of a generic wrapper template. As the pages get more complex, however, I end up repeating a lot of code and I'm trying to work out how to best build sites out of lots of little parts. That works great when things go from abstract/generic to specific as I get deeper, but there seems to be a tension between that sort of hierarchy and the global concept of a "page". For example, our CMS at work has a lot of SEO meta data for each page that is pasted into the wrapper template. That works fine when all you have are two layers, but as I start to wrap views inside views inside views, I end up with data that is needed on both ends of the hierarchy. How do people solve this?

  2. #2
    SitePoint Addict
    Join Date
    Nov 2005
    Location
    Germany
    Posts
    235
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm facing similar problems at the moment. My Views are divided in pages and modules with lots of jQuery. Many modules depend on includes I have to load in the "parent" pages, so I assumed it would be a good idea to implement something like this:

    PHP Code:
    $page = new ViewPage();
    $module = new ViewModuleX();
    $page->addModule($module);
    $page->setIncludes($module->getIncludes()); 
    Where View::getIncludes() returns some kind of data structure containing it's own additional *.js and *.css and those of all contained modules.

    I guess you can use something similar for any meta data.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •