├── README.md ├── admin ├── addpage.php ├── editpage.php ├── index.php └── login.php ├── includes ├── config.php └── functions.php ├── index.php ├── setup.php └── style ├── login.css └── style.css /README.md: -------------------------------------------------------------------------------- 1 | Simple CMS 2 | ============= 3 | 4 | These files acompany the tutorial: [Building a content management system from scratch](http://daveismyname.com/building-a-content-management-system-from-scratch-bp) -------------------------------------------------------------------------------- /admin/addpage.php: -------------------------------------------------------------------------------- 1 | 26 | 27 | 28 |
29 | 30 |Title | 75 |Action | 76 |$row->pageTitle | "; 84 | if($row->pageID == 1){ //home page hide the delete link 85 | echo "pageID\">Edit | "; 86 | } else { 87 | echo "pageID\">Edit | pageID','$row->pageTitle');\">Delete | "; 88 | } 89 | 90 | echo ""; 91 | } 92 | ?> 93 |
---|
Sample Sample content
'), 22 | (2, 'About', 1, 'Sample Sample content
'), 23 | (3, 'Services', 1, 'Sample Sample content
'), 24 | (4, 'News', 1, 'Sample Sample content
'), 25 | (5, 'Contact', 1, 'Sample Sample content
'); -------------------------------------------------------------------------------- /style/login.css: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------+ 2 | | Content Management System 3 | | http://www.phphelptutorials.com/ 4 | +--------------------------------------------------------+ 5 | | Author: David Carr Email: dave@daveismyname.com 6 | +--------------------------------------------------------+*/ 7 | 8 | body { 9 | background:#e0e0e0; 10 | margin:0 auto 0; 11 | padding:0; 12 | font-family:Verdana, Arial, Helvetica, sans-serif; 13 | color:#333333; 14 | } 15 | 16 | 17 | div.lwidth { 18 | width:500px; 19 | margin:80px auto 0; 20 | padding:0; 21 | background:#FFFFFF; 22 | } 23 | 24 | /* default forms */ 25 | form input, form textarea, select { 26 | border:1px solid #999999; 27 | border-bottom-color:#cccccc; 28 | border-right-color:#cccccc; 29 | padding:5px; 30 | font-family:Arial, Helvetica, sans-serif; 31 | font-size:1.0em; 32 | margin:2px; 33 | } 34 | 35 | form input.button { 36 | background:#0D7ABF none repeat-x scroll bottom left; 37 | color:#ffffff; 38 | border:1px solid #00F; 39 | color:#ffffff; 40 | font-size:0.8em; 41 | padding:6px 14px; 42 | font-weight:bold; 43 | font-family:Verdana, Arial, Helvetica, sans-serif; 44 | } 45 | 46 | label { 47 | float:left; 48 | margin-right:10px; 49 | width:180px; 50 | font-weight:bold; 51 | } 52 | /* content */ 53 | div.page-wrap { 54 | padding:20px; 55 | clear:both; 56 | background-color:#fff; 57 | } 58 | 59 | div.content { 60 | float:left; 61 | width:100%; 62 | padding-right:20px; 63 | font-size:90%; 64 | } 65 | 66 | /* footer */ 67 | div.footer { 68 | background:none repeat scroll 0 0 #262626; 69 | clear:both; 70 | color:#FFFFFF; 71 | padding:10px; 72 | text-align:center; 73 | } 74 | 75 | 76 | /* MESSAGES */ 77 | .msg-info, .msg-atten, .msg-ok, .msg-error { margin:3px 0; padding:10px 10px 10px 40px; -moz-border-radius:5px; -webkit-border-radius:5px; } 78 | .msg-info { background:#ADC2F7 url(../images/icons/msg-info.png) 6px center no-repeat; border:1px solid #6D94F7; color:#03C; } 79 | .msg-atten { background:#FAE673 url(../images/icons/msg-atten.png) 6px center no-repeat; border:1px solid #FEBD63; color:#C60; } 80 | .msg-ok { background:#AEE893 url(../images/icons/msg-ok.png) 6px center no-repeat; border:1px solid #8EC46C; color:#060; } 81 | .msg-error { background:#F4B8B5 url(../images/icons/msg-error.png) 6px center no-repeat; border:1px solid #C94042; color:#900; } 82 | /* END OF MESSAGES */ 83 | 84 | -------------------------------------------------------------------------------- /style/style.css: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------+ 2 | | Content Management System 3 | | http://www.phphelptutorials.com/ 4 | +--------------------------------------------------------+ 5 | | Author: David Carr Email: dave@daveismyname.com 6 | +--------------------------------------------------------+*/ 7 | 8 | body { 9 | font-size: 80%; 10 | font-family:Arial, Helvetica, sans-serif; 11 | margin:0; 12 | } 13 | 14 | #wrapper { 15 | margin:auto; 16 | width:960px; 17 | } 18 | 19 | /* Header informatiom */ 20 | 21 | #logo { 22 | font-size:20px; 23 | height:23px; 24 | margin-bottom:10px; 25 | margin-top:10px; 26 | width:235px; 27 | } 28 | 29 | /* Navi informatiom */ 30 | 31 | #navigation{ 32 | background:#000000; 33 | height:40px; 34 | } 35 | 36 | /*** Superfish SKIN ***/ 37 | .menu { 38 | float: left; 39 | margin-bottom: 1em; 40 | padding:0px; 41 | } 42 | .menu a { 43 | padding: .75em 1em; 44 | text-decoration:none; 45 | color:#ffffff; 46 | } 47 | .menu a { 48 | color:#ffffff; 49 | } 50 | .menu li { 51 | background:#000000; 52 | display:inline; 53 | } 54 | 55 | /* Content informatiom */ 56 | 57 | #content { 58 | width:960px; 59 | margin:auto; 60 | } 61 | 62 | /* Footer informatiom */ 63 | 64 | #footer { 65 | clear:both; 66 | color:#fff; 67 | height:auto; 68 | margin:auto; 69 | padding:10px; 70 | width:960px; 71 | background:#000; 72 | margin-bottom:10px; 73 | } 74 | 75 | 76 | /* links ----------------------------------------------------------------------- */ 77 | 78 | a { 79 | text-decoration:none; 80 | color:#2d67a7; 81 | background-color: inherit; 82 | } 83 | 84 | a:hover { 85 | text-decoration:underline; 86 | } 87 | 88 | 89 | /* headings -------------------------------------------------------------------- */ 90 | 91 | 92 | h1 { 93 | font-size: 1.5em; 94 | line-height: 1em; 95 | padding-bottom:0.2em; 96 | } 97 | 98 | h2 { 99 | border-bottom:1px solid #E4E4E4; 100 | font-size:20px; 101 | margin:0 0 15px; 102 | padding:0 0 15px 10px; 103 | } 104 | 105 | h3 { 106 | font-size: 1.3em; 107 | margin: 0 0 0.5em 0; 108 | font-weight:bold; 109 | } 110 | 111 | h4 { 112 | font-size: 1.2em; 113 | line-height: 1.3em; 114 | margin: 0 0 0.5em 0; 115 | font-weight:bold; 116 | margin:0 0 0.6em 0; 117 | color:#CC9933; 118 | } 119 | 120 | h5 { 121 | font-size: 1em; 122 | line-height: 1.5em; 123 | color:#000; 124 | } 125 | 126 | label { 127 | float:left; 128 | font-weight:bold; 129 | margin-right:10px; 130 | width:180px; 131 | } 132 | 133 | .button { 134 | background:#0D7ABF none repeat-x scroll bottom left; 135 | color:#ffffff; 136 | border:1px solid #00F; 137 | color:#ffffff; 138 | font-size:0.8em; 139 | padding:6px 14px; 140 | font-weight:bold; 141 | font-family:Verdana, Arial, Helvetica, sans-serif; 142 | } 143 | 144 | /* MESSAGES */ 145 | .hidethis { cursor:pointer; } 146 | .msg-info, .msg-atten, .msg-ok, .msg-error { margin:3px 0; padding:10px 10px 10px 40px; -moz-border-radius:5px; -webkit-border-radius:5px; } 147 | .msg-info { background:#ADC2F7 6px center no-repeat; border:1px solid #6D94F7; color:#03C; } 148 | .msg-atten { background:#FAE673 6px center no-repeat; border:1px solid #FEBD63; color:#C60; } 149 | .msg-ok { background:#AEE893 6px center no-repeat; border:1px solid #8EC46C; color:#060; } 150 | .msg-error { background:#F4B8B5 6px center no-repeat; border:1px solid #C94042; color:#900; } 151 | /* END OF MESSAGES */ 152 | 153 | /* table */ 154 | table {width:98%; border:1px solid #DDDDDD; font-size:12px; color:#000;background:#fff; margin-bottom:10px;} 155 | table th {background-color:#E5E5E5; border:1px solid #BBBBBB; padding:3px 6px; font-weight:normal; color:#000;} 156 | table tr td {border:1px solid #DDDDDD; padding:5px 6px;} 157 | table tr.alt td {background-color:#E2E2E2;} 158 | table tr:hover {background-color:#F0F0F0; color:#000;} --------------------------------------------------------------------------------