Presentation is loading. Please wait.

Presentation is loading. Please wait.

 Pages within our Framework  Categories within Framework  Products within Framework  Model-View-Controller description of Page, category and products.

Similar presentations


Presentation on theme: " Pages within our Framework  Categories within Framework  Products within Framework  Model-View-Controller description of Page, category and products."— Presentation transcript:

1

2  Pages within our Framework  Categories within Framework  Products within Framework  Model-View-Controller description of Page, category and products  Routing Requests

3 FieldsFields TypeDescription IdInt (Primary Key, Auto Increment) A reference to framework for content entity Current_ revision IntRefer to current version of content type ActiveBooleanActive or inactive to show user SecureBooleanSecure or insecure to show either logged in user or not ParentIntA reference to its parent content type OrderIntA reference to the order of the content type to build sitemap or menus AuthorIntWho created the first version of content type TypeIntA reference to type of content this entity is PathVarcharSearch engine friendly path for the content CreatedTiemstampWhen the entity is created

4  To enable pages in framework we need:  A model-Connection to database and represent data on page  A controller- will look up the current page  A template (view)- display data on page to user  With all above, we need some extra information  Menu and Sub menu options  Breadcrumb generation

5  Model  Ability to connect to database  Search for a page given by page name/path  Represent data on the page  If no page found, generate “Page not found” error  Can be achieved using a constructor  Pass page path as parameter  Set values to properties if page found  Set particular value if page not found

6  We need following methods for page model  isValid(): used by controller to lookup if the page is valid or not?  isActive(): used by controller to lookup if the page is active or not?  isSecure(): used by controller to check if the page is secure or not? And accessible to user or not?  getProperties(): return the properties of the page to integrated with view

7  Page view should have following template pages  Header- to have common header on most of the pages  Footer- to have common footer on most of the pages  Page- to display the page to user  We my have additional pages in template  404 Error: indicates page not found  Login: logged in by user to access secure pages  Page Disable: show page is inactive

8 Header Template It may also contain CSS, JavaScript, Icon etc information

9  Footer Template  It may contain copyright info, about us, terms and conditions etc.  Page Template  In case of “Page not found” template

10  We may have other templates in framework  Page Disable template  Login Form template  Signup Form template  Shipping Address template  Change password template  Shopping Cart template  And sooooooooooooooo on Can be limited with limited requirements

11  Controller of pages needs to perform the following task  Clean the path requested  Pass path to page model  If the page is valid, convert page properties to tags to use in template, output the page view  If the page is invalid, display 404 page  If the page is valid and secure, display the page if user is logged in, else direct user to login page

12  We breakdown functionality into 3 areas  Model- manage product data by update, save, clone  Controller- interpret users requests, interface with model, interact with view to display data  Template- to display list of products to end user

13  Product model needs the following functionality:  Lookup a product based on a product path  Determine if a product exists or not, based on said path  Store product data  Return product data as an array  Return a Boolean value indicating if a product is valid or not

14 Product View

15  Product Controller needs the following functionality  Needs to communicate with controller  Clean the path requested  Pass product URL path to controller  If a valid product URL, display it using view  If not a valid URL, display “product not found” page

16  Our categories functionality of framework will be same as products model and controller with some minor difference  Not as many tables are required to get the category detail, content_version table is enough  Categories need to list products contained within them  We have to deal with child-parent categories structure

17  Categories Model  Is complex than other product and pages model because it deals with categories and sub categories  In First stage ▪ Use subqueries, that will count no. of subcategories ▪ Queries are then cached and its references are passed to template or view to display products  In 2 nd Stage ▪ Adding some additional functions in controller about cached queries, if there are any subcategory

18  Categories View  We need 3 types of templates to display categories to end user  Category template  Subcategory template  Products Template within category

19  Categories View  Category template

20  Categories View  Subcategory template

21  Categories View  Products template

22  Categories Controller  Communicate with Model to get categories  If no category found, show “No Category Found” page  List categories and sub categories using view  If no subcategory found, show “No Subcategory Found” page  List products within categories using views, if any, else show “No Product in Category”

23  In our framework, so far, the models, controllers and views of products, categories, pages have same format  Thy can be improved using inheritance in PHP  Common classes can be defined with common functionalities  Product view includes one photo of product  Product view can be changed to mange more photos of products

24  First path of the URL should include the area of site that user is trying to access  http://domain/sitearea etc http://domain/sitearea  We need to maintain a list of active controllers  If sitearea match with any active controller  Include controller file, create controller object, pass control to framework controller  Else shows 4o4 page error or “Page not found”

25  We need a controller table to save list of active controllers


Download ppt " Pages within our Framework  Categories within Framework  Products within Framework  Model-View-Controller description of Page, category and products."

Similar presentations


Ads by Google