Jump to content



Recommended Posts

  • 2 months later...

Creating a CMS is not so easy but if you are really keen of accepting challenges then you should follow the following steps:

  1. Create the database
  2. Create the articles database table
  3. Make a configuration file
  4. Build the Article class
  5. Write the front-end index.php script
  6. Write the back-end admin.php script
  7. Create the front-end templates
  8. Create the back-end templates
  9. Create the stylesheet and logo image.
Link to comment
Share on other sites

I personally design the CMS first by that I mean I do a mock-up of what I visualize what the CMS is going to look like by creating a static HTML page with CSS. That way I know how it's going to look like and the setup of the PHP.

Here's a visual description on what I'm trying to get at: (Obviously this is after the PHP being added)

        <?php foreach ($cms as $record) { ?>
            <article class="cms" itemscope itemtype="http://schema.org/Article">
                <header itemprop="articleBody">
                    <div class="byline" itemprop="author publisher" itemscope itemtype="http://schema.org/Organization">
                        <img itemprop="image logo" class="logo" src="assets/images/img-logo-004.png"
                             alt="website logo">
                        <h2 itemprop="headline" class="title"><?= $record['heading'] ?></h2>

                        <span itemprop="name" class="author_style">Created by <?= $record['author'] ?> on
                        <time itemprop="dateCreated datePublished"
                              datetime="<?= htmlspecialchars(CMS::styleTime($record['date_added'])) ?>"><?= htmlspecialchars(CMS::styleDate($record['date_added'])) ?></time></span>
                    <img itemprop="image" class="article_image"
                         src="<?php echo htmlspecialchars($record['image_path']); ?>" <?= getimagesize($record['image_path'])[3] ?>
                         alt="article image">
                <p><?= nl2br($record['content']) ?></p>
        <?php } ?>

The main thing to take away from all of this is the naming of the variables as they are consistent to the database table:

create table cms
    id           int auto_increment
        primary key,
    user_id      int                          null,
    author       varchar(160)                 null,
    page         varchar(255) default 'index' null,
    thumb_path   varchar(255)                 null,
    image_path   varchar(255)                 null,
    Model        varchar(255)                 null,
    ExposureTime varchar(255)                 null,
    Aperture     varchar(255)                 null,
    ISO          varchar(255)                 null,
    FocalLength  varchar(255)                 null,
    heading      varchar(60)                  null,
    content      text collate utf8_unicode_ci null,
    date_updated datetime                     null,
    date_added   datetime                     null

I would start off using procedural PHP when creating the first CMS and it still can be very robust. A lot of planning beforehand can save a lot of headaches later on.


Didn't realize this was an old thread as I'm still waking up. 😁

Edited by Strider64
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.