Code Monkey home page Code Monkey logo

Comments (9)

gazjoy avatar gazjoy commented on June 6, 2024

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.

daveredfern avatar daveredfern commented on June 6, 2024

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.

daveredfern avatar daveredfern commented on June 6, 2024

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.

daveredfern avatar daveredfern commented on June 6, 2024

global.yml

  • site-name
  • tagline
  • tel
  • email

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.

daveredfern avatar daveredfern commented on June 6, 2024

@jakecobley reckon we can get some basic integration this month? Nothing fancy, we can start small.

from chopchop.

jakecobley avatar jakecobley commented on June 6, 2024

@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.

daveredfern avatar daveredfern commented on June 6, 2024

@jakecobley great!

from chopchop.

jakecobley avatar jakecobley commented on June 6, 2024

PR #122

from chopchop.

daveredfern avatar daveredfern commented on June 6, 2024
// 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.