GithubHelp home page GithubHelp logo

phpbridge / docs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from railsbridge/docs

25.0 5.0 15.0 18.45 MB

Curriculum for PHPBridge workshops

Home Page: phpbridge.org

License: Other

Ruby 39.12% CSS 60.37% JavaScript 0.51%

docs's Introduction

The PHPBridge Documentation Project

Build Status

Lovingly Based on RailsBridge

Thanks to the amazing work of the volunteers behind RailsBridge and their decision to release all of their content under a Creative Common (CC-BY) license, we are able to create PHPBridge by standing on their shoulders and building up.

Overview

This is a Sinatra app, deployed at http://docs.railsbridge.org. The PHPBridge documentation project is home to a few subprojects, including the PHPBridge installfest instructions, which leads students through the various complicated setup instructions for getting PHP, MySQL, Git, etc. installed on their computer (whatever combination of computer, OS, and version they happened to bring to the workshop!), as well as the PHPBridge workshop "Suggestotron" curriculum.

Each subproject (a "site") comprises files stored under the "sites" directory; for instance, the installfest instructions are located at ROOT/sites/en/installfest, while the intro PHP curriculum can be found under ROOT/sites/en/intro-to-php.

These files can be in any of these formats:

(If multiple files exist with the same base name, .step is preferred over .md, and .md over .mw.)

Usage

bundle install
rake run

If the above fails (say, because rerun doesn't work on your system), try

rackup

Then open http://localhost:9292 in a web browser, and verify that you can navigate the installfest slides.

Locales

To serve sites from "sites/en", use rake run or a vanilla deploy.

To server sites from another locale (say, "es" or Spanish)...

  • Locally, use the SITE_LOCALE environment variable: SITE_LOCALE=es rake run
  • On a server, make the server respond to a locale subdomain: http://es.railsbridge.org
  • Or to temporarily test, use a locale or l parameter: http://docs.railsbridge.org/?l=es (note that in this mode, links are not rewritten, so if they fail you will have to manually add the parameter again)

Contributing

Check out CONTRIBUTING.md to see how to join our list of contributors!

Resources

docs's People

Contributors

alexch avatar annaswims avatar cczona avatar chancancode avatar dladowitz avatar dosire avatar dshafik avatar eanakashima avatar ericpoe avatar erikpukinskis avatar intuedge avatar jasonnoble avatar jbx72487 avatar jesseplusplus avatar jessieay avatar kejadlen avatar kerrizor avatar lilliealbert avatar mfjenn avatar michellesanver avatar naomiq avatar nuclearsandwich avatar rachelfenn avatar rachelmyers avatar romyilano avatar tdenkinger avatar tjarratt avatar tjgrathwell avatar ultrasaurus avatar windmillium avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

docs's Issues

Error in Creating a Data Class - Step 3

public function getAllTopics()
{
    $query = $this->connection->prepare("SELECT * FROM topics");
    $query->execute();
     return $query;
}

The function return the query object and not the topics.

I think you need change "return $query;" for "return $query->fetchAll();"
Another option is modify the function getAllTopics with oneline
"return $this->connection->query("SELECT * FROM topics");"

Indent: tabs vs spaces

Files are a mix of tabs and spaces for indents. Which should we use? If spaces, how many?

Index.php and index.phtml is confusing people

Need a better way to word things maybe? It is confusing for people to distinguish between index.php and the index view, possibly just adding a tip so that people pay more attention to it could work.

the mix of "" and '' in a line

there's a random mix of '' and "" in (for example) step 5 of "create a data class" which is probably going to screw someone up - I'd suggest using one or another throughout the examples and code ('' would be my preference for beginners) - the usage of " blah " . is especially egregious

Please create a version for kids, similar to Ruby's http://hackety.com/

I've attended last week a Code.org workshop about teaching K-5 kids computers. Unfortunately, when you look at the upcoming "Hour of code" (http://code.org/learn), PHP for kids is missing there.

Could you please create a "PHP Tutorial" version for kids, similar to Ruby's http://hackety.com/ or
Python's https://groklearning.com/ - both are mentioned on http://code.org/learn

If we want the young generations to use PHP, we need something to win their hearts and minds!

In editing topics expected result is wrong

The edit.php step by step is either out of order or has an additional "view output" in the wrong spot. If you create edit.php with the <?=$topic in it, you'll get an undefined variable warning.

Routes not working for me

I'm running on PHP 5.3. The use of [] verses array() also is a problem. Any idea why routes don't work though?

Delete operation occurs within GET method

The code here indicates that a delete operation can be conducted within a GET operation. This is not ideal, as an automated system (web crawler, link pre-fetcher) might go off and delete things, seemingly at random.

To protect against this, wrap the item list in a POST form and use a submit button for the delete. The handler code needs to be updated to only respond to POST, too.

Change , to ;

Immediately after ($fruits), here:

for ($i = 0; $i < sizeof($fruits), $i++) {
echo $fruits[$i] . PHP_EOL;
}

HTML trapped inside echo statements

I suggest the following code (taken from here):

<html>
    <head>
        <title>Suggestotron</title>
    </head>
    <body>
        <?php
        foreach ($topics as $topic) {
            echo "<h3>" .$topic['title']. " (ID: " .$topic['id']. ")</h3>";
            echo "<p>";
            echo nl2br($topic['description']);
            echo "</p>";
            echo "<p>";
            echo "<a href='/edit.php?id=" .$topic['id']. "'>Edit</a>";
            echo " | ";
            echo "<a href='/delete.php?id=" .$topic['id']. "'>Delete</a>";
            echo "</p>";
        }
        ?>
    </body>
</html>

becomes like so:

<html>
    <head>
        <title>Suggestotron</title>
    </head>
    <body>
        <?php foreach ($topics as $topic): ?>
            <h3>
                <?php echo $topic['title'] ?> (ID: <?php echo $topic['id'] ?>)
            </h3>
            <p>
                <?php echo echo nl2br($topic['description']) ?>
            </p>
            <p>
                <a href="/edit.php?id=<?php echo $topic['id'] ?>">Edit</a>
                |
                <a href="/delete.php?id=<?php echo $topic['id'] ?>">Edit</a>
            </p>
        <?php endforeach ?>
    </body>
</html>

Reasoning: HTML should not be trapped inside echo statements. It prevents modern editors from syntax-checking the HTML or colourising it. Also, there's less need for concatenation, so it looks nicer.

Incidentally, I've swapped the brace-style foreach for a colon-style. There's a rule of thumb that the former belongs in code files and the colon-style is preferred in template files, because the ending is much more explicit. Not essential for this ticket but nice to add, IMO.

I expect there are others too, but it's worth raising a ticket to see if this is in keeping with house style first. Of course, htmlspecialchars() is required too, but that's another ticket.

bundle install error

When I first downloaded the package last night,I saw an error when I ran bundle install

$ bundle install
Gemfile syntax error compile error
on line 25: syntax error, unexpected ':', expecting $end
gem 'debugger', group: [:development, :test]
^

pretty URL

I'm having issues with the Pretty URL's. When I click on edit or delete I get Object not found! When I edit .htaccess with a WordPress mod rewrite, I no longer get the error but it will not load the edit or delete files.

Filter Input, Escape Output

Security is a mindset, not an after the fact addition

The db stuff does a good job of mentioning using bound params to deal with sql injection but there is nothing about the other end of security - FIEO

From the first moment POST and GET are mentioned and used the idea of filtering input (validating you got what you expected) and escaping output (a wrapper with htmlspecialchars would suffice for beginners) should be introduced

Just the basics are needed, nothing fancy - an output escaper function/method to use when echoing stuff out and the use of filter_var to make sure data is right from a POST is plenty good for a beginner level, but introducing the idea of "the user is a jerk and will try to break stuff" is good for beginning dev minds ;)

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.