SlideShare una empresa de Scribd logo
1 de 25
Flexible site structure
    with CakePHP
       Andy Gale


                   www.andy-gale.com
T3
A gadget,
technology and
lifestyle magazine
T3
Internationally
licensed...
T3
Pioneering interactive iPad magazine
T3
                  Future Publishing




• A popular title on Zino - an online
  publishing platform
  www.zinio.com


• Also a popular UK website
  destination for gadget fans
  www.t3.com
T3
              Future Publishing




• Flagship brand for Future Publishing
• T3 Awards being an important part
  of the UK calendar

• Many competitors - online, blogs
  such as Engadget and Gizmodo

• Quick-to-publish vital on gadget
  websites
T3 - Just use Drupal or Wordpress!



• Many Future websites now in Drupal or
  Wordpress
  www.pcgamer.com
  www.netmagazine.com


• Pressflow (a distribution of Drupal) is an
  excellent platform for publishing
  websites
  pressflow.org


• Drupal and Pressflow with Varnish scales
  www.varnish-cache.org
T3 - Just use Drupal or Wordpress?




• No need to build another CMS?
• But the site editors had unique
  requirements for their workflow
Editable custom content boxes
                                     Popular list features need to
                                     be fast and easy to create




Easy to update trending and ticker
Various different types of galleries including super galleries!
Flexible site structure

• Obviously, articles, galleries, other
  lists of content are stored in
  database

• We also stored the site structure in
  the database using the Tree
  behaviour.
Editable custom content boxes
Elements
Model:
CREATE TABLE elements (
! id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
! name VARCHAR(255) DEFAULT '',
! PRIMARY KEY (id)
);




Name field, just the filename of a
CakePHP element
<div>
<h3>Latest</h3>
<ul>
  <li><a href="/news/iphone5red">iPhone 5 actually Red</a></li>
  <li><a href="/news/iphone5blue">iPhone 5 to Blue</a></li>
</ul>

[children]
SiteObject                               Element
id: 1                                    id: 1
name: Latest smartphone news             name: content_boxes/list.ctp
type: ContentBox
element_id: 1
content_id: 50



    SiteObject
    id: 50
    name: Latest smartphone news list
    type: List


                      SiteObject        Article
                      id: 51            id: 1
                      type: List        name: Black Samsung
                      parent_id: 50     Galaxy S3 coming soon
                      article_id: 1


                      SiteObject        Article
                      id: 52            id: 2
                      type: List        name: Motorola RAZAR Ice
                      parent_id: 50     Cream Sandwich update out
                      article_id: 2     now


                      SiteObject        Article
                      id: 53            id: 3
                      type: List        name: Supposed Apple
                      parent_id: 50     iPhone 5 motherboard hints
                      article_id: 3     at features
Hero article content box




SiteObject
id: 1
name: Samsung Galaxy Note 2: Hands On            Element
type: ContentBox                                 id: 2
element_id: 2                                    name: content_boxes/hero.ctp
article_id: 4




                 Article
                 id: 4
                 name: Black Samsung Galaxy S3 coming soon
Tree Behaviour
                               <body>
                               id: 1
                               left: 1, right:
                               10


           <header>                                 <main>
           id: 2                                    id: 5
           parent: 1                                parent: 1
           left: 2, right: 7                        left: 8, right: 13



<h1> & logo           <nav>                  <article>            <aside>
id: 3                 id: 4                  id: 6                id: 7
parent: 2             parent: 2              parent: 5            parent: 5
left: 3, right: 4     left: 5, right: 6      left: 9, right: 10   left: 11, right: 12


             book.cakephp.org/1.3/en/view/1339/Tree
So what about the structure?
All page elements were grouped together
as different types of “site object”
CREATE TABLE site_objects (
! id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
! parent_id INTEGER(10) UNSIGNED DEFAULT NULL,
! lft INTEGER(10) UNSIGNED DEFAULT NULL,
! rght INTEGER(10) UNSIGNED DEFAULT NULL,
! name VARCHAR(255) DEFAULT '',!
! page_id INTEGER(10) UNSIGNED DEFAULT NULL,
! article_id INTEGER(10) UNSIGNED DEFAULT NULL,
! element_id INTEGER(10) UNSIGNED DEFAULT NULL,
! content_id INTEGER(10) UNSIGNED DEFAULT NULL,
! PRIMARY KEY (id)
);

Page
CREATE TABLE pages (
! id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
! name VARCHAR(255) DEFAULT '',!
! title VARCHAR(255) DEFAULT '',!
! meta_description TEXT DEFAULT
! meta_keywords TEXT DEFAULT NULL,
! name VARCHAR(255) DEFAULT '',!
! url VARCHAR(255) DEFAULT '',!
! PRIMARY KEY (id)
);
URLs
• The structure of each “Page” or URL
  was defined in a tree

• /news takes you to the page
  structure for news articles

• /news/new-iphone5-released takes
  you to the page structure associated
  with the new articles that has the
  slug “new-iphone5-released”
  allowing different layouts for
  articles from trades shows
Content?

• element_id field contains a reference to
  the element that should be used to
  display this content

• content_id field in SiteObject refers to
  another SiteObject which contains
  information about where to find the
  content

• That content could be a list of articles,
  images, a carousel... anything that the site
  supports
Content?



• Backend process updates lists periodically
• Key lists such as the homepage lists of
  articles are updated whenever articles
  change

• Allows easy updating of caching. See:
  andy-gale.com/positive-cache-clearing-with-cakephp.html
Caching!!!!!!

• Caching vital when implementing a
  site using this methodology

• Structure and content both
  SiteObjects can be cached in the
  same way

• Caching need to be updated fast to
  ensure new articles were published
  as soon as possible
Caching


                CMS
                   Cache update sent as a
                   topic via STOMP protocol



              ActiveMQ                   Multiple clients can
                                         subscribe to a topic so
                                         all web servers that are
                                         listening can update
                                         their cache immediately
                                         and serve new content




Web server   Web server        Web server
CSS, elements and flexible
            Structure

• Consistent CSS style guide for each
  component vital for implementing a
  flexible site structure

• Elements should work wherever
  they are placed

• Twitter Bootstrap is a great example
  twitter.github.com/bootstrap/
Flexible site structure with CakePHP




• Code to be released on my GitHub
  page shortly:
  github.com/salgo/


• Avoiding Surprises with Chef and
  Vagrant
  Attend if you’ve ever had problems
  with configuration or anything else
  when putting sites live
Flexible site structure with CakePHP




• Questions?
• @andygale on Twitter
• andy-gale.com on the Web

Más contenido relacionado

La actualidad más candente

Even faster web sites
Even faster web sitesEven faster web sites
Even faster web sitesFelipe Lavín
 
Ryan Fishberg and Joan Lafferty - ItemsRenderers
Ryan Fishberg and Joan Lafferty - ItemsRenderersRyan Fishberg and Joan Lafferty - ItemsRenderers
Ryan Fishberg and Joan Lafferty - ItemsRenderers360|Conferences
 
Plug and Play Tools for the Recruiting Empiricist
Plug and Play Tools for the Recruiting EmpiricistPlug and Play Tools for the Recruiting Empiricist
Plug and Play Tools for the Recruiting EmpiricistJung Kim
 
Html5的应用与推行
Html5的应用与推行Html5的应用与推行
Html5的应用与推行Sofish Lin
 
Getting the most out of Radiant
Getting the most out of RadiantGetting the most out of Radiant
Getting the most out of Radiantjomz83
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Themecertainstrings
 
Develop your first mobile App for iOS and Android
Develop your first mobile App for iOS and AndroidDevelop your first mobile App for iOS and Android
Develop your first mobile App for iOS and Androidralcocer
 
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails
Hypermedia: The Missing Element to Building Adaptable Web APIs in RailsHypermedia: The Missing Element to Building Adaptable Web APIs in Rails
Hypermedia: The Missing Element to Building Adaptable Web APIs in RailsToru Kawamura
 
Integrating Search Driven Content in SharePoint 2013/2016/O365
Integrating Search Driven Content in SharePoint 2013/2016/O365Integrating Search Driven Content in SharePoint 2013/2016/O365
Integrating Search Driven Content in SharePoint 2013/2016/O365Eric Overfield
 
SharePoint 2013 Search Driven Sites - SPSHOU
SharePoint 2013 Search Driven Sites - SPSHOUSharePoint 2013 Search Driven Sites - SPSHOU
SharePoint 2013 Search Driven Sites - SPSHOUBrian Culver
 
NewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress ThemeNewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress ThemeAdam Darowski
 
Integrating citations from RefWorks without Write-N-Cite
Integrating citations from RefWorks without Write-N-CiteIntegrating citations from RefWorks without Write-N-Cite
Integrating citations from RefWorks without Write-N-CiteJohn Pell
 
Kohana 3.2 documentation
Kohana 3.2 documentationKohana 3.2 documentation
Kohana 3.2 documentationdmthuan1
 
Building Mobile Applications with Ionic
Building Mobile Applications with IonicBuilding Mobile Applications with Ionic
Building Mobile Applications with IonicMorris Singer
 
Learning Wordpress - the internal guide
Learning Wordpress - the internal guideLearning Wordpress - the internal guide
Learning Wordpress - the internal guidetom altman
 

La actualidad más candente (20)

Even faster web sites
Even faster web sitesEven faster web sites
Even faster web sites
 
Top SEO Factors (2014/2015)
Top SEO Factors (2014/2015)Top SEO Factors (2014/2015)
Top SEO Factors (2014/2015)
 
1428393873 mhkx3 ln
1428393873 mhkx3 ln1428393873 mhkx3 ln
1428393873 mhkx3 ln
 
Ryan Fishberg and Joan Lafferty - ItemsRenderers
Ryan Fishberg and Joan Lafferty - ItemsRenderersRyan Fishberg and Joan Lafferty - ItemsRenderers
Ryan Fishberg and Joan Lafferty - ItemsRenderers
 
Plug and Play Tools for the Recruiting Empiricist
Plug and Play Tools for the Recruiting EmpiricistPlug and Play Tools for the Recruiting Empiricist
Plug and Play Tools for the Recruiting Empiricist
 
Introduction to HTML5 & CSS3
Introduction to HTML5 & CSS3Introduction to HTML5 & CSS3
Introduction to HTML5 & CSS3
 
Html5的应用与推行
Html5的应用与推行Html5的应用与推行
Html5的应用与推行
 
Getting the most out of Radiant
Getting the most out of RadiantGetting the most out of Radiant
Getting the most out of Radiant
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Theme
 
Develop your first mobile App for iOS and Android
Develop your first mobile App for iOS and AndroidDevelop your first mobile App for iOS and Android
Develop your first mobile App for iOS and Android
 
IBM Connection - customize it, #dd13
IBM Connection - customize it, #dd13IBM Connection - customize it, #dd13
IBM Connection - customize it, #dd13
 
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails
Hypermedia: The Missing Element to Building Adaptable Web APIs in RailsHypermedia: The Missing Element to Building Adaptable Web APIs in Rails
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails
 
Integrating Search Driven Content in SharePoint 2013/2016/O365
Integrating Search Driven Content in SharePoint 2013/2016/O365Integrating Search Driven Content in SharePoint 2013/2016/O365
Integrating Search Driven Content in SharePoint 2013/2016/O365
 
SharePoint 2013 Search Driven Sites - SPSHOU
SharePoint 2013 Search Driven Sites - SPSHOUSharePoint 2013 Search Driven Sites - SPSHOU
SharePoint 2013 Search Driven Sites - SPSHOU
 
NewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress ThemeNewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress Theme
 
Integrating citations from RefWorks without Write-N-Cite
Integrating citations from RefWorks without Write-N-CiteIntegrating citations from RefWorks without Write-N-Cite
Integrating citations from RefWorks without Write-N-Cite
 
Kohana 3.2 documentation
Kohana 3.2 documentationKohana 3.2 documentation
Kohana 3.2 documentation
 
Selenium for-ops
Selenium for-opsSelenium for-ops
Selenium for-ops
 
Building Mobile Applications with Ionic
Building Mobile Applications with IonicBuilding Mobile Applications with Ionic
Building Mobile Applications with Ionic
 
Learning Wordpress - the internal guide
Learning Wordpress - the internal guideLearning Wordpress - the internal guide
Learning Wordpress - the internal guide
 

Similar a Flexible site structure with cake php

Progressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQueryProgressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQueryTodd Zaki Warfel
 
Frontend for developers
Frontend for developersFrontend for developers
Frontend for developersHernan Mammana
 
memories of tumblr gear & Tumblrowl
memories of tumblr gear & Tumblrowlmemories of tumblr gear & Tumblrowl
memories of tumblr gear & Tumblrowlhonishi
 
Code & Design your first website 4/18
Code & Design your first website 4/18Code & Design your first website 4/18
Code & Design your first website 4/18TJ Stalcup
 
Moving from Web 1.0 to Web 2.0
Moving from Web 1.0 to Web 2.0Moving from Web 1.0 to Web 2.0
Moving from Web 1.0 to Web 2.0Estelle Weyl
 
HTML5, just another presentation :)
HTML5, just another presentation :)HTML5, just another presentation :)
HTML5, just another presentation :)François Massart
 
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nlSource Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nlJoomla!Days Netherlands
 
Modeling Rich Narrative Content
Modeling Rich Narrative ContentModeling Rich Narrative Content
Modeling Rich Narrative ContentJeff Eaton
 
Html5 Brown Bag
Html5 Brown BagHtml5 Brown Bag
Html5 Brown Bagstuplum
 
Web Design Bootcamp - Day1
Web Design Bootcamp - Day1Web Design Bootcamp - Day1
Web Design Bootcamp - Day1Aslam Najeebdeen
 
Getting started with titanium
Getting started with titaniumGetting started with titanium
Getting started with titaniumNaga Harish M
 
Advanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & EfficiencyAdvanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & EfficiencyDenise Jacobs
 
Getting started with Appcelerator Titanium
Getting started with Appcelerator TitaniumGetting started with Appcelerator Titanium
Getting started with Appcelerator TitaniumTechday7
 
CICON2010: Phil Sturgeon - Running an Open-Source CodeIgniter project
CICON2010: Phil Sturgeon - Running an Open-Source CodeIgniter projectCICON2010: Phil Sturgeon - Running an Open-Source CodeIgniter project
CICON2010: Phil Sturgeon - Running an Open-Source CodeIgniter projectCodeIgniter Conference
 
Running an Open-Source CodeIgniter project
Running an Open-Source CodeIgniter projectRunning an Open-Source CodeIgniter project
Running an Open-Source CodeIgniter projectPhil Sturgeon
 

Similar a Flexible site structure with cake php (20)

Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3
 
Progressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQueryProgressive Prototyping w/HTML5, CSS3 and jQuery
Progressive Prototyping w/HTML5, CSS3 and jQuery
 
Frontend for developers
Frontend for developersFrontend for developers
Frontend for developers
 
Titanium Alloy Tutorial
Titanium Alloy TutorialTitanium Alloy Tutorial
Titanium Alloy Tutorial
 
memories of tumblr gear & Tumblrowl
memories of tumblr gear & Tumblrowlmemories of tumblr gear & Tumblrowl
memories of tumblr gear & Tumblrowl
 
Code & Design your first website 4/18
Code & Design your first website 4/18Code & Design your first website 4/18
Code & Design your first website 4/18
 
Html5 ux london
Html5 ux londonHtml5 ux london
Html5 ux london
 
Moving from Web 1.0 to Web 2.0
Moving from Web 1.0 to Web 2.0Moving from Web 1.0 to Web 2.0
Moving from Web 1.0 to Web 2.0
 
HTML5, just another presentation :)
HTML5, just another presentation :)HTML5, just another presentation :)
HTML5, just another presentation :)
 
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nlSource Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
 
Modeling Rich Narrative Content
Modeling Rich Narrative ContentModeling Rich Narrative Content
Modeling Rich Narrative Content
 
CSS 201
CSS 201CSS 201
CSS 201
 
Html5 Brown Bag
Html5 Brown BagHtml5 Brown Bag
Html5 Brown Bag
 
Web Design Bootcamp - Day1
Web Design Bootcamp - Day1Web Design Bootcamp - Day1
Web Design Bootcamp - Day1
 
Getting started with titanium
Getting started with titaniumGetting started with titanium
Getting started with titanium
 
Jekyll, static websites generator
Jekyll, static websites generatorJekyll, static websites generator
Jekyll, static websites generator
 
Advanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & EfficiencyAdvanced CSS Troubleshooting & Efficiency
Advanced CSS Troubleshooting & Efficiency
 
Getting started with Appcelerator Titanium
Getting started with Appcelerator TitaniumGetting started with Appcelerator Titanium
Getting started with Appcelerator Titanium
 
CICON2010: Phil Sturgeon - Running an Open-Source CodeIgniter project
CICON2010: Phil Sturgeon - Running an Open-Source CodeIgniter projectCICON2010: Phil Sturgeon - Running an Open-Source CodeIgniter project
CICON2010: Phil Sturgeon - Running an Open-Source CodeIgniter project
 
Running an Open-Source CodeIgniter project
Running an Open-Source CodeIgniter projectRunning an Open-Source CodeIgniter project
Running an Open-Source CodeIgniter project
 

Último

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 

Último (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 

Flexible site structure with cake php

  • 1. Flexible site structure with CakePHP Andy Gale www.andy-gale.com
  • 5. T3 Future Publishing • A popular title on Zino - an online publishing platform www.zinio.com • Also a popular UK website destination for gadget fans www.t3.com
  • 6. T3 Future Publishing • Flagship brand for Future Publishing • T3 Awards being an important part of the UK calendar • Many competitors - online, blogs such as Engadget and Gizmodo • Quick-to-publish vital on gadget websites
  • 7. T3 - Just use Drupal or Wordpress! • Many Future websites now in Drupal or Wordpress www.pcgamer.com www.netmagazine.com • Pressflow (a distribution of Drupal) is an excellent platform for publishing websites pressflow.org • Drupal and Pressflow with Varnish scales www.varnish-cache.org
  • 8. T3 - Just use Drupal or Wordpress? • No need to build another CMS? • But the site editors had unique requirements for their workflow
  • 9. Editable custom content boxes Popular list features need to be fast and easy to create Easy to update trending and ticker
  • 10. Various different types of galleries including super galleries!
  • 11. Flexible site structure • Obviously, articles, galleries, other lists of content are stored in database • We also stored the site structure in the database using the Tree behaviour.
  • 13. Elements Model: CREATE TABLE elements ( ! id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, ! name VARCHAR(255) DEFAULT '', ! PRIMARY KEY (id) ); Name field, just the filename of a CakePHP element <div> <h3>Latest</h3> <ul> <li><a href="/news/iphone5red">iPhone 5 actually Red</a></li> <li><a href="/news/iphone5blue">iPhone 5 to Blue</a></li> </ul> [children]
  • 14. SiteObject Element id: 1 id: 1 name: Latest smartphone news name: content_boxes/list.ctp type: ContentBox element_id: 1 content_id: 50 SiteObject id: 50 name: Latest smartphone news list type: List SiteObject Article id: 51 id: 1 type: List name: Black Samsung parent_id: 50 Galaxy S3 coming soon article_id: 1 SiteObject Article id: 52 id: 2 type: List name: Motorola RAZAR Ice parent_id: 50 Cream Sandwich update out article_id: 2 now SiteObject Article id: 53 id: 3 type: List name: Supposed Apple parent_id: 50 iPhone 5 motherboard hints article_id: 3 at features
  • 15. Hero article content box SiteObject id: 1 name: Samsung Galaxy Note 2: Hands On Element type: ContentBox id: 2 element_id: 2 name: content_boxes/hero.ctp article_id: 4 Article id: 4 name: Black Samsung Galaxy S3 coming soon
  • 16. Tree Behaviour <body> id: 1 left: 1, right: 10 <header> <main> id: 2 id: 5 parent: 1 parent: 1 left: 2, right: 7 left: 8, right: 13 <h1> & logo <nav> <article> <aside> id: 3 id: 4 id: 6 id: 7 parent: 2 parent: 2 parent: 5 parent: 5 left: 3, right: 4 left: 5, right: 6 left: 9, right: 10 left: 11, right: 12 book.cakephp.org/1.3/en/view/1339/Tree
  • 17. So what about the structure? All page elements were grouped together as different types of “site object” CREATE TABLE site_objects ( ! id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, ! parent_id INTEGER(10) UNSIGNED DEFAULT NULL, ! lft INTEGER(10) UNSIGNED DEFAULT NULL, ! rght INTEGER(10) UNSIGNED DEFAULT NULL, ! name VARCHAR(255) DEFAULT '',! ! page_id INTEGER(10) UNSIGNED DEFAULT NULL, ! article_id INTEGER(10) UNSIGNED DEFAULT NULL, ! element_id INTEGER(10) UNSIGNED DEFAULT NULL, ! content_id INTEGER(10) UNSIGNED DEFAULT NULL, ! PRIMARY KEY (id) ); Page CREATE TABLE pages ( ! id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, ! name VARCHAR(255) DEFAULT '',! ! title VARCHAR(255) DEFAULT '',! ! meta_description TEXT DEFAULT ! meta_keywords TEXT DEFAULT NULL, ! name VARCHAR(255) DEFAULT '',! ! url VARCHAR(255) DEFAULT '',! ! PRIMARY KEY (id) );
  • 18. URLs • The structure of each “Page” or URL was defined in a tree • /news takes you to the page structure for news articles • /news/new-iphone5-released takes you to the page structure associated with the new articles that has the slug “new-iphone5-released” allowing different layouts for articles from trades shows
  • 19. Content? • element_id field contains a reference to the element that should be used to display this content • content_id field in SiteObject refers to another SiteObject which contains information about where to find the content • That content could be a list of articles, images, a carousel... anything that the site supports
  • 20. Content? • Backend process updates lists periodically • Key lists such as the homepage lists of articles are updated whenever articles change • Allows easy updating of caching. See: andy-gale.com/positive-cache-clearing-with-cakephp.html
  • 21. Caching!!!!!! • Caching vital when implementing a site using this methodology • Structure and content both SiteObjects can be cached in the same way • Caching need to be updated fast to ensure new articles were published as soon as possible
  • 22. Caching CMS Cache update sent as a topic via STOMP protocol ActiveMQ Multiple clients can subscribe to a topic so all web servers that are listening can update their cache immediately and serve new content Web server Web server Web server
  • 23. CSS, elements and flexible Structure • Consistent CSS style guide for each component vital for implementing a flexible site structure • Elements should work wherever they are placed • Twitter Bootstrap is a great example twitter.github.com/bootstrap/
  • 24. Flexible site structure with CakePHP • Code to be released on my GitHub page shortly: github.com/salgo/ • Avoiding Surprises with Chef and Vagrant Attend if you’ve ever had problems with configuration or anything else when putting sites live
  • 25. Flexible site structure with CakePHP • Questions? • @andygale on Twitter • andy-gale.com on the Web

Notas del editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n