Top Banner
V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS
16

V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

Dec 22, 2015

Download

Documents

Phillip Griffin
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

V 1.0 OE NIK, 2013 1

PHP+SQL10.

CRUD reviewCMS

Page 2: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

V 1.0 OE NIK, 2013 2

PHP+SQL10.

CRUD reviewCMS

Page 3: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

V 1.0

Reading user input

Page 4: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

V 1.0

It is done in a loop (to avoid preg_replace / PCRE)

Replacement

Page 5: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

V 1.0

Creating <select> inputs

Page 6: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

V 1.0

Genres + Songs

OE NIK, 2013 6

Page 7: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

V 1.0

Structure of a CRUD module• Actions:

– MOD– EDIT– DEL– SHOW– LIST

• Every action modifies $output (or redirects)• Main CMS approach: this $output is not the full page!

OE NIK, 2013 7

Page 8: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

V 1.0 OE NIK, 2013 8

PHP+SQL10.

CRUD reviewCMS

Page 9: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

V 1.0

TYPICAL WEBPAGE STRUCTURE

9OE NIK, 2014

Page 10: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

V 1.0

THE GOD OF <DIV>• Easier to design/change• Easier to separate the style and the content using CSS• By default a block-level element, but this can be changed• float: none, left, right• clear:both

10OE NIK, 2014

Page 11: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

V 1.0

CMS basic requirements• mod_rewrite to create SEO URLs• For every page: ID, code, name, module, html, default

OE NIK, 2013 11

Page 12: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

V 1.0

Songs module – modifications in the HTML• <form action='index.php?action=EDIT&id=[song_id]' method='POST'>

<form action='[page_code]?action=EDIT&id=[song_id]' method='POST'>

• Instead of http://localhost/dir/ index.php?action=EDIT&id=42 , the form will submit to http://localhost/dir/songs?action=EDIT&id=42

• We should change the same references in the PHP file too

OE NIK, 2013 12

Page 13: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

V 1.0

Songs module – modifications in the PHP• $page should always contain the page code• Move import(), designer_replace(),

create_select_from_array(), addlink() to general.php• (Add isloggedin(), draw_menu() to general.php)

• Check for CMSMOD comments in the html and php files– Changed every addlink(“index.php?action=xxx”) code

to addlink(“{$page}?action=xxx”)– Changed every header(“location: index.php”) code to

header(“location: {$page}”)– $module_html="html/song_form.html";

OE NIK, 2013 13

Page 14: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

V 1.0

CMS Tasks• Download 10_lcms_part.zip• Structure??? Files??? .htaccess???• We should implement the index.php ( CMS

organization) and sample.module.inc.php (login/logout)• Songs module: WORKS out-of-the-box

OE NIK, 2013 14

Page 15: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

V 1.0 OE NIK, 2013 15

Page 16: V 1.0 OE NIK, 2013 1 PHP+SQL 10. CRUD review CMS.

16OE NIK, 2013