To provide another example of Lookup usage, if you are a photographer and you provide your clients with a passcode like jimsusanwedding11, they can enter that passcode in the box and get forwarded through to a gallery page called jimsusanwedding11.html on your website. In another example, you could use the Lookup stack to retrieve forms or PDF documents from an online cloud, based on the document reference number entered. Or if you provide customers with coupon codes, they can enter them in the box and get forwarded to a particular page on your website with special discounts listed.

Unlike many copy-and-paste javascript code snippets already available online, this stack does actually work in web browsers made after 1998! The lookup stack leverages some powerful PHP code and is both easy to setup and has plenty of customisable options to satisfy most users. Most importantly, it is easy for your customers to use, and a wrongly-typed passcode results in a customisable error message being displayed.

Important As mentioned already, this stack provides a low-security login system. Although passcodes and full page addresses are not presented in the source code, it would still be possible to 'guess' the page address and gain access to unencrypted pages or files. If you need a more robust login solution which physically encrypts pages, then consider something like Lockdown, WeaverBox or WeaverFM instead.


Examples

PDF document

Type example in the input box below and click download, to retrieve a secret PDF file from DropBox.
In this example the path in the Lookup settings was set to http://dl.dropbox.com/u/422052/stacks4stacks/test/ and the file extension was set to .pdf. When you type the actual file name in the box above, it completes the URL and provides a link to the PDF file:

http://dl.dropbox.com/u/422052/stacks4stacks/test/example.pdf

Password box

Type secret in the input box below and click open.
This example uses the password input type, which is available for selection in the Lookup input type settings. Typed passcodes are entered in the form of a password, and are obfuscated by dots. Additionally if the web browser has any keychain or password utilities available (like 1Password), the user will be prompted to save the passcode. When you type the word 'secret' in the box above, it completes the URL and provides a link to the file:

http://dl.dropbox.com/u/422052/stacks4stacks/test/lookup/secret.html

Photographs

Type mypicture.jpg or mypicture.gif in the box below and click view image.
In this example, the file extension setting in the Lookup settings comprises of a blank space ( ), so an end user can decide themselves whether to open the JPG or GIF version of the image. When you type the word 'mypicture.jpg' or 'mypicture.gif' in the box above, it completes the URL and provides a link to the image:

http://dl.dropbox.com/u/422052/stacks4stacks/test/lookup/mypicture.jpg
or
http://dl.dropbox.com/u/422052/stacks4stacks/test/lookup/
mypicture.gif

Coupon Codes

Type discount16 in the box below.
If a successful discount code is entered, the customer will get redirected to the discount16 page on your website. As like previous examples, the passcode discount16 completes the URL and redirects a user to that particular resource:

http://dl.dropbox.com/u/422052/stacks4stacks/test/lookup/discount16.html

As this page demonstrates, you can safely use multiple Lookup stacks on a single page. The Lookup stack is also compatible with the @import function in PlusKit, so you can import Lookup stacks into non-stack pages. Some people prefer to use browser defaults for styling forms in web pages, however several dozen settings are included for you to apply custom styling to both the input field and submit button. Options also exist to change the input box placeholder text and the submit button title. Although the Lookup stack uses PHP code, the page hosting the form field and submit button can be left as a regular HTML page, if you prefer. If you opt to have the input box displayed as a password field, keychain software like 1Password will offer to save the passcode for you.

Setup

  1. Once installed, drag and drop a Lookup stack into your page
  2. In the Base URL box, enter the initial URL like http://www.example.com/folder/
  3. If a file extension, forward-slash character or other content needs to be appended after the value a user types in the box, then enter this in the extension box.
  4. In the Input Type menu, choose whether to use a standard text box ot a password box. Both work in a similar way, except typed characters are replaced with dots, when using the password box option.
  5. The input box placeholder text and the submit button text can both be changed, if required.
  6. Optionally, you can change the colour and style of both the input box and submit button, using the settings provided

Customising the error message

If a user mistypes the wrong passcode, a simple error message is displayed informing them of their mistake and providing a "try again" button. This message gets generated by the PHP code, based on whether a matching URL can be found or not. To edit the error message, go to Finder and click Go > Go to folder from the menu. In the window that opens, type (or paste) the following:

~/Library/Application Support/RapidWeaver/Stacks/
Then click Go.

In the new window that opens, right-click on your S4S-Lookup.stack file, and select Show Package Files. Click on Contents, then click on Resources. Open the process.php file in your favourite code editor, and scroll down towards the bottom, where you will see a comment and the existing HTML error code. Change the text to whatever you want and enter custom code or scripts. You can add additional text, links, graphics and CSS. Save the file when done and restart RapidWeaver for the changes to take place in your stack. If you have problems finding or customising this file, please get in contact. Unfortuantly Stacks does not currently allow us to write code or styled content into an asset like process.php, so the editing has to be done manaully for now.

System Requirements

This stack requires a web server with support for PHP5 and cURL. Most hosts do support these things and will be able to confirm if you contact them. You will not be able to preview the Lookup stack in RapidWeaver. But if you publish the website or view it in your sites folder (with PHP enabled) or in MAMP, you can test the Lookup stack offline. Because of the dependancy on PHP support, the Lookup stack will not work with MobileMe hosting and will likely fail on cheap hosts (these companies often use non-standard versions of PHP or charge extra to enable PHP as part of your hosting package). You are strongly advised to download and test the free demo version provided, before purchasing the Lookup stack. If you can't get the demo to work, then do not purchase this stack. It may be unsuitable for your needs.

Stacks4Stacks

Stacks4Stacks provides quality stack elements for RapidWeaver, backed by fast and friendly expert support direct from the developer. All stacks are intended for use with the Stacks plugin and can be used in both fixed-width and responsive page layouts. These stacks can help you achieve new things in your web development projects, meet client objectives and basically get jobs done a whole lot faster! We provide a wide variety of both free and paid stack elements, suitable for various different tasks. Over the past few years, the Stacks4Stacks project has been responsible for bringing some of the most influential stack elements to RapidWeaver.

The entire Stacks4Stacks website was built using RapidWeaver and the Stacks plugin. The theme being used in this website is Volcano by ThemeFlood. Should you have any questions or comments about this website or any of the stack elements featured, please feel free to get in contact. Stacks4Stacks is hosted by the rather excellent Chillidog Hosting.

RapidWeaver is a registered trademark of Realmac Software LTD, Brighton, UK.



Top 10 Stacks4Stacks