Comments (9)
It would be nice to have a global config to be able to pass through things like the site name, url, client contact info. This information could appear in the header of the index.
from chopchop.
Our current thinking, to expand on this, is the use yaml files to store data such as product titles, blog posts, prices, image paths. I suggest this is in a folder called data in the root of chopchop. Inside that a file for each data. e.g. blog-title.yml.
Then with functions we can retrieve them such as:
getData('blog-title');
printData('blog-title'); // prints out
This is probably enough for now. Later we can expand if we feel necessary.
from chopchop.
Maybe we could target things inside the yaml files too. For example we could have a global.yaml file in our data and then do:
getData('global', 'site-name');
This would retrieve the site name inside the global yml file. If we just did the following it would retrieve a random entry:
getData('global');
Same would apply to blog titles, we could do either of the following:
getData('blog-title');
getData('blog-title', 5); // return 5th item
Obviously this is all open to ideas. Just throwing thoughts after speaking to @gazjoy and @ejrowley over the last few months.
from chopchop.
global.yml
- site-name
- tagline
- tel
product-title.yml
blog-title.yml
product-title.yml
price.yml
author.yml
blog-cateories.yml
product-catergories.yml
color.yml
size.yml
number.yml
function:
name of file
specific item (by site-name or 3)
random / in order
<p class="logo"><?php printData('global', 'site-name'); ?></p>
<p><?php printData('price'); ?></h2>
<h2><?php printData('blog-title', 2); ?></h2>
<h2><?php echo getData('blog-title', 2); ?></h2>
<?php for($i=0;$i<5;$i++) : ?>
<h2><?php printData('blog-title', $i); ?></h2>
<?php endfor; ?>
from chopchop.
@jakecobley reckon we can get some basic integration this month? Nothing fancy, we can start small.
from chopchop.
@daveredfern yeah defiantly. Aiming to get a ruff implementation shortly. Will be mapping everything out Thursday so will likely give you a shout then.
from chopchop.
@jakecobley great!
from chopchop.
PR #122
from chopchop.
// Grabs the site name from the site name variable in the global.yml file in the data directory.
<?php printData('global', 'site-name'); ?>
// Grabs a random entry from the title object within the blog object in the blog.yml file in the data directory.
<?php printData('blog', 'title'); ?>
// Grabs the first (starts from 0) title from the title object within the blog object in the blog.yml file in the data directory.
<?php printData('blog', 'title' 0); ?>
// Grabs the second (starts from 0) author from the author object within the blog object in the blog.yml file in the data directory.
<?php printData('blog', 'author', 1); ?>
// Grabs the second (starts from 0) blog title from the blog-title object in the blog-titles.yml file in the data directory.
<?php printData('blog-title', 1); ?>
// Grabs a random entry from the blog-titles object in the blog-titles.yml file in the data directory.
<?php printData('blog-title'); ?>
from chopchop.
Related Issues (20)
- Lovely Checkboxes
- PHP bugs with new layout HOT 1
- Check Prevent Default Stopping Hyperlinks HOT 1
- Make navigation active on load
- Reduce the width of patterns HOT 1
- Base doesn't order at the top
- Variables Folder HOT 1
- Add jquery no conflict
- Make script js part of kitchen sink
- Tidy up card/payment icons
- Function to return array of classes in stylesheet HOT 3
- Toggle widget overrides jQuery core .toggle
- Update company info to chopchop
- Improve Picture Pattern
- Searchable Patterns
- Checkbox Pattern Fix
- Rating Pattern Fix
- Viewport Meta minimal-ui deprecated
- IE Customer Select
- Ditch Gulp Combine MQ
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chopchop.