getchopchop / chopchop

Front end user interface primer toolkit for the pro's
https://getchopchop.github.io
MIT License
31 stars 7 forks source link

Refactor PHP #131

Closed daveredfern closed 7 years ago

daveredfern commented 8 years ago

The PHP is becoming more and more of a mess. We need to bring it under control.

daveredfern commented 8 years ago

New folder structure:

data
inc -> framework
pattern
src

Inc becomes framework and encompasses everything that is chopchop code. The idea to make it easily upgradable.

Inside framework break down the files into more digestible nuggets.

daveredfern commented 8 years ago

Each pattern to exist as a folder with a base.php pattern. If a doc.md exists we want to pull that in. So an example:

pattern-name
pattern-name/1-base.php
pattern-name/2-variation.php
pattern-name/docs.md

It would be displayed something similar to this:

image

So...

Title comes from folder name. Docs comes from docs.md Then each pattern is from each file.

daveredfern commented 8 years ago

Inside a pattern we want the following options (although an easy way to add them would be amazing).

Code: true / false (true by default)

This toggles whether the view code link is visible/

Class: .classname
daveredfern commented 8 years ago

Functions that work inside each pattern:

printPattern('name-of-pattern', $data);
getPattern('name-of-pattern', $data);
getData('file-name', 'section', num);
PrintData('file-name', 'section', num);
getSvg('location-name');
printSvg('location-name');
getUrl('location'); // gets base url
daveredfern commented 8 years ago

A config file in the root called config.php would be good. Here we can change the folder order and structure. This currently lives in an array at the bottom of functions.php.

gazjoy commented 8 years ago

Also getLink needs to be added in: #42

gazjoy commented 7 years ago

@daveredfern checkout the section-readme branch. @Triickii has done us a solid. Have a play/test and we can get this merged asap.