Home | Actions library | Simple Include
Download Freeway Actions

Actions for Freeway

Home

Actions for Freeway

News

Actions for Freeway

What is Freeway

Actions for Freeway

All about Freeway actions

Actions for Freeway

Freeway ActionsWhat are actions?

Actions for Freeway

Actions for FreewayInstalling actions

Actions for Freeway

Freeway Pro ActionsApplying actions

Actions for Freeway

Plug-ins for FreewayHandling errors

Actions for Freeway

Extend FreewayAction types

Actions for Freeway

Templates for FreewayWriting actions

Freeway Actions

Actions library

Actions for Freeway

Beta Box

Actions for Freeway

Custom development

Actions for Freeway

Action links

Actions for Freeway

Site map

Actions for Freeway

Contact

Free templates for Freeway
   

Donate:


Although this action, like many others on this site, are free we do ask that you consider making a donation. All funds collected go directly back into the continued development of the actions and this site.

FatCow are a Freeway-friendly web host and offer everything a Freeway Express or Freeway Pro user need to get their sites online fast, and hassle free.



 

Description:
HTML documents are all well and good for storing web pages but what do you do when you want to add a bit of something special and create a block of dynamic content? You could turn to any number of server or client side technologies to do your bidding but one of the simplest is bundled up with every Apache server in the form of Server-Side Includes (SSI)s.

Although admittedly not as powerful and resourceful as, say, PHP or ASP, SSIs are simple to implement and are very portable allowing your pages to be moved from server to server and still work with no fuss.

Although SSI lets us embed any number of special commands into our pages to do things like inserting the document's last modification time we'll be looking at just one; the file command. Using this we can insert content dynamically into a standard HTML page when the page is called from the server.

When the page is requested Apache looks inside the file and substitutes a file reference in the SSI tag for the content of the external file. If you look at the source code of the final HTML page all you will see is the merged code. By default Apache will pre-process any HTML pages that have the .shtml suffix. If this doesn't work you may need to check with your service provider that SSI processing is on and that this extension hasn't been changed. The Simple Include action demonstrates how we can use an action in Freeway to extract the body of a HTML page and use it to create an include file that we can use later to insert into another page. We can also use the action to automatically pull this external file back into another Freeway generated page as a SSI should we so wish.


Adding the action to your pages:
Follow the†' Applying Page Actions
' guidelines.
 

Using the actions:
Contained in the action file are two actions; Create Simple Include and Use Simple Include. As their names suggest they are for generating and deploying the include files within Freeway's pages.

To create an include apply the Create Simple Include action to the page you wish to pull the content from by selecting Actions/Create Simple Include from the Page menu. Using the Create Simple Include tab in the actions palette give the include a suitable name. By default the name of the include is based on the page name although you can choose to override this at any time with your own names. Names should ideally be restricted to alpha numeric characters (a-Z and 0-9) and without spaces to avoid any problems with the server locating the file later on.

When the site is published or previewed the action strips out the content contained between the body tags and generates an include file based on this code. The action will store the include in a folder in the same location as the Freeway file with the same name but prefixed with an underscore. From here you can use this include anywhere else in your site.

To pull this include into another page we can do so simply by utilizing the Use Simple Include action. The process is almost identical of that outlined above.

Apply the Use Simple Include action to the page we want to add the include to by selecting Actions/Create Simple Include from the Page menu. Again, in the actions palette specify the name of the include you created previously. By using a name based scheme like this we can both create and use many includes in a single Freeway site file. The 'Use' action also gives you the choice of merging the include data inside Freeway or with a standard SSI tag and have the data merged on the server. You may decide to merge the data locally until the site is ready to be uploaded to the web server so that you can preview it without Apache having to be run locally.

Files that are merged remotely on the server need to be marked so that Apache knows to look inside them for the SSI tags. By default we do this by changing the file suffix to .shtml.


Moving on:
Page based includes are all well and good but the appeal can be quite limiting since all we are doing is removing and grafting back on the body content of one HTML page to another. A much more powerful solution is to use this concept on the item level rather than the page. That is exactly where Simple Include Pro comes in. By building on the concept of the Simple Include action we can now apply the action to an item on the Freeway page and use that item elsewhere in the same document knowing that it will be an exact duplicate of the original. Change the master and all of the children will change as well. Very much like an item based style sheet tool the Simple Include Pro action brings a greater level of power and uniformity to Freeway produced site content.

 

Requirements:
Freeway 3.0 or above.


Browser compatibility:
All, as the data is merged on the server prior to the browser seeing the page.


Download:
Click here (33 K) to download a copy of this action.

warning Please note
The downloading and use of files from this site is covered by our standard terms and conditions policy. In doing so you acknowledge acceptance of these terms.

 

Actions for Freeway
Freeway actions