Coder Social home page Coder Social logo

rs.flattener's Introduction

Page Flattener is a simple php tool that converts php pages to static html pages. I generally use it when a client absolutely HAS to have their deliverable as static HTML pages, and when there are generally many rounds of text revisions.

In the case where copy is in the header, and you've got 30 or more
pages, you'll have to make the same update 30 times and hope you don't 
make an error. Or do a search against the whole project and validate
the results of what should be a simple find/replace. Also not ideal.

With Page Flattener, you build out pages in PHP using simple includes 
to reference common, re-used page elements, and then automatically spit out the 
html files. When you need to make a copy change in the header, you simply 
update the file containing the header markup, flatten the project, and all 
your html files are updated instantly.

When you're ready to ZIP up the files for the client, just click the "Zip it up" button, and a zip will be automatically generated with a date and time stamp for you.



USAGE

1. Clone/download this project

Note that the flattener will ONLY scan folders that are in the same directory as itself.
So if you're projects are in Xampp/htdocs, flattener should be checked out there.



2. Project structure

Page Flattener requires your project to have a folder called 'php' with a blank 
file named .flats in it. For example:

/myProject
	/assets
		/other
		/stuff
		/here
	/php
		.flats
		/tpl -> this could also be named includes, as long as your include statements can find it
			.noflats -> put an empty file called .noflats in any sub-folder you want the flatener to skip..
		/sub-directory (you may have any number of sub-folders)
		

- The 'php' folder must be in the main project dir (not assets/php). 
- php files in the main /php folder wil be replicated as .html files in the main project directory
- sub-folders will be replicated in the main directory, with any php files replicated as html files therein.



3. Building

To start building pages, start making .php files in the 'php' folder. Something
like index.php. Any pages that are found in the main 'php' folder will be transformed 
to html files in the main project directory.

For common elements across multiple pages (header, footer, whatever), 
make a sub-folderini the 'php' folder, name it something like tpl. Files in sub-folders are 
NOT converted to html pages.


4. Flatten
When you're ready to generate the HTML files, navigate your browser to:

http://localhost/rs.flattener

If you've followed the folder structure above, your project should appear in the
project drop down box on the left. Click the "flatten !" button and the pages will
appear in the pages pane.

That's basically it.



PHP example:

<?php

$page_header = "";
$page_title="Some Page title or something";
$site_metta = "Some meta tag text"; 

include('tpl/header.php'); 
?>
<div id="pallet">
	<div id="header">
		<?php include('tpl/topNav.php'); ?>
		<div id="hero">
			More html and whatnot
		</div>
	</div> 
	
	<div id="columns">
		<?php include('tpl/leftNavB.php');?>
		<div id="mainColumn">
		
		
		</div>
	</div> 

</div> 
<?php 
  include('tpl/footer.php'); 
?>


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.