1

I developed a web site some years ago in PHP and mySQL. I'm wondering if it would be worthwhile to convert it to a CMS like Craft.

  • The site -- http://blacksmiths.mygenwebs.com -- displays information on historical figures -- "tradesmen". These are arranged by region, so "Devon", for example, contains all people who lived in that region and performed that service.

  • The lady the site belongs to collects the data and puts it into a spreadsheet and uploads the comma-delimited .csv files to the site. (no, she won't consider abandoning her spreadsheets)

  • The software reads the .csv files and creates a page for each .csv file

  • It also uses the CSV file to create the home page (at the link above)

I would like to change the operation slightly

  • have the uploaded .csv data placed into a database table and the pages be dynamically generated from there (there are only nine fields in each row).

  • have a form where she can input new data

  • be able to export the data to the spreadsheet format she likes

There is also an administrative back-end, all in PHP-mySQL, that stores data on contributors, which tradsman they contributed and their email address, if it is to be displayed on one of the pages (right now, the email uses javascript obfuscation, but each should really use a contact form to protect the email addresses).

  • it would be useful to create links between the tradesman table record and the contributor table record.

I can do all this in PHP, but I'd like to see if Craft could make this simpler.

I'm looking for suggestions as to whether going to a CMS like Craft would be a good idea and perhaps some suggestions on how to go about it.

2 Answers 2

2

Craft is using PHP and MySQL. What it gives you is a framework where a lot of the difficult stuff is already covered. Things like content modelling, user administration, security, etc is already done.

In addition there is a good plugin environment that can help fill in gaps to required functionality.

Of course, you can also extend it as you wish to add even more custom functionality.

For your particular use case I'd say Craft is a very good fit. You wouldn't need to be concerned with building an administration interface and the data you wish to store can be easily modelled.

Since your client wants to keep the spreadsheets then a plugin like FeedMe would be brilliant. You can set up an import in FeedMe and have it pull in the data from the spreadsheet using a cronjob or when your client wants to run an update. She'd just need to click a button. The data from the spreadsheet would be imported and used to create new, or update existing, content entries.

You might find that given Craft's really nice control panel she would also find that it's easier to enter data directly than follow the spreadsheet->import process.

So yes. Craft would be a very good fit.

Edited in light of your comment/question

You don't need to create your own database tables or write your own queries. That is what Craft is doing for you.

Craft is extremely flexible in that it will allow you to model your content pretty much however you wish. This data model is then stored within Craft's own database schema and content is written/read (by Craft) using the Yii/Yii2 PHP framework. You would then use the templating language (Twig) to create a front-end for the website with no need to use PHP at all.

So, let's say you had a Section of entries for Blacksmiths. Each Blacksmith is an entry, with whatever fields you wish stored within them.

Let's assume you want to list out all of the Blacksmith's stored in the Blacksmiths section to create an index.

You might do that within your template with Twig like so:

{% set blacksmiths = craft.entries.section('blacksmiths').orderBy('title').all() %}

This would give you an iterable object named 'blacksmiths' that you could loop over to output the content you want (taking a rough version of your actual listing page).

<table>
    {% for blacksmith in blacksmiths %}
     <tr>
        <td>{{ blacksmith.surname }}</td>
        <td>{{ blacksmith.firstname }}</td>
        <td>{{ blacksmith.trade }}</td>
        <td>{{ blacksmith.year }}</td>
        <td>{{ blacksmith.notes }}</td>
      </tr>
    {% endfor %}
</table>

If you wanted to alter precisely which blacksmith entries to retrieve you would include some additional criteria in your initial query. You don't need to worry about joins because the data has been stored within Craft's schema and Craft handles any criteria or relations that are required.

3
  • thanks for the input. Does Craft have a way to do inner/outer/full joins of tables?
    – tcloud
    Commented Jan 15, 2019 at 13:37
  • I think you may have a misunderstanding of what Craft is and how it works. You don't need to create custom tables nor write SQL queries to get data (although you can if you wish to get into writing your own 'business logic' plugins). It is effectively an abstraction layer over the database. Content is stored as "entries" which can be grouped, related, or whatever. You would then build your site templates to fetch this data with the templating language, Twig.
    – foamcow
    Commented Jan 16, 2019 at 12:43
  • Craft is extremely flexible in that it will allow you to model your content pretty much however you wish. This data model is then stored within Craft's own database schema and content is written/read (by Craft) using the Yii/Yii2 PHP framework. You would then use the templating language (Twig) to create a front-end for the website with no need to use PHP at all.
    – foamcow
    Commented Jan 16, 2019 at 12:46
2

Pros:

  • Craft is extremely flexible--so it is definitely possible to accomplish whatever you want
  • It has a great back-end interface for the maintainer of the website (can update the site just from your phone, even. However, it sounds like your 'client' is not really interested in that.

Cons:

  • Craft is quite complex under the hood, and to write the kind of plugin you might want, you need to understand topics like PHP namespacing. If you are used to just writing some down-and-dirty php to make the job work, I would advise that you face integrating that into a much larger structure that was designed by somebody else.

Philosophical point: It seems that every technology that will improve or speed things up for us comes with a learning curve that ultimately steals that benefit away. The up-front time spent learning a new system doesn't save us time in the end, unless we use that system constantly. So if you're planning to become a full-time Craft CMS developer, then learning this will be great. Otherwise, it would be faster to keep going the way you have been, and spend your life doing other things.

1
  • 1
    Just to clarify. Based on his description and my observations of the site in question, what the OP wants to do won't require a custom plugin. But agreed, if it's a one off case and you don't need the convenience of having a lot of stuff (including the admin interface) already done for you then it might not make sense.
    – foamcow
    Commented Jan 16, 2019 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.