SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Ähnlich wie Flexible site structure with CakePHP and database-driven layouts

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
 

Ähnlich wie Flexible site structure with CakePHP and database-driven layouts (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
 

Kürzlich hochgeladen

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 

Kürzlich hochgeladen (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 

Flexible site structure with CakePHP and database-driven layouts

  • 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

Hinweis der Redaktion

  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