Coder Social home page Coder Social logo

slightly_routed's Introduction

slightly_routed

Slightly Routed is a small web framework which let's you create php websites which have routing à la Rails' views

Why should i use this?

You want to build a template driven website with url routing (so that the Google loves you), but all other frameworks are just too big and do waaaaay more than you need. Also, you would prefer if you could just make the pages in plain html/js with some php peppered around. You don't want to learn a new templating language just for that.

What do i need?

Apache webserver with PHP5

How to use this?

  • download and unpack
  • enable mod_rewrite on Apache (if it isn't allready that is)
  • to edit the default layout change the 'site/layout.php' file. All other pages will be rendered from inisde the main layout
  • to add more pages to the site, do it like they do it in Rails :) Detailed explanation follows:

How to add more pages to my site?

slightly_routed will map urls to the pages within your sites' root. For example:

www.mysite.com/foo => "/foo.php"

You can use folders as well

www.mysite.com/foo/bar =>"/foo/bar.php"

What if you want a page "foo" and a folder "foo"? Make a "foo" folder, and add index.php within it. Than it'll work like this:

www.mysite.com/foo => "/foo/index.php"

What if you have both "foo.php" page in the sites' root and the "foo" folder? Then folders index will be rendered, and page ignored

IMPORTANT! use only ".php" extension for your pages. For now, it's the only way

Does it have caching/security/feature_x?

Nope, but i'm open to suggestions. Fork and make a pull request.

Thank-you's and acknowledgements

Shout-out to my friend Milan Levnajić who needed such small but versatile framework and for whom i built this in the first place.

Many thanks to FlorianH who build the very cool routing library Router which was used as a starting point for slightly_routed.

In the end, thanks Rails team since the i nicked the folder routnig thingie mechanich from the way Rails renders views. I just threw out the controller parts

slightly_routed's People

Contributors

markokacanski avatar

Watchers

André Philip avatar James Cloos avatar  avatar

slightly_routed's Issues

Images cannot be linked

src attributes are routed like any request, which makes the browser respond with a full page instead of image

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.