Cat Stack
Catenate (or insert) the contents of any file into your web page, like copying or appending or including, or like simple CMS. Any way you cut it, this is useful for adding content.How does it work?
PHP is used to read the remote file and dump its contents.
People ask - why "cat?" From the unix "cat" command to catenate a file (a fancy way to say "look at it's contents!")
Parameters | |
File to read | Specify the file name or URL to catenate. This file may be plain text, HTML, Markdown, or any other format such as CSV. |
Treat file as PHP and include | Enable this to include other PHP files instead of their content. If you wish to show the contents of a PHP file, do not enable this. |
HTML within <body> only | Scan within <body> and </body> tags to ignore other content of HTML files that can cause problems. |
Search string | Optional filtering: only show lines that contain this search string, case sensitive. If this is left blank then all lines from the file/url are shown. |
Skip lines | Skip the first lines of the file. This may be useful if you want to use this Stack to ignore a file header. A value of zero here means do not skip any lines. |
Max input | Set this value to non-zero to set a limit to the number of lines read, after any skipped lines. This may be useful if you want to use this Stack to show a snippet of file content but not the whole file. A value of zero here means no limit. |
Parse Markdown | Treat file contents as Markdown and convert to HTML. |
Sort input | Enable sorting of input lines, and use the options below to control sorting method, case, and order. |
... sort naturally | The default is regular sorting (a1,a10,a2,b1,b10,b2). Enable this option to sort naturally, as humans (a1,a2,a10,b1,b2,b10). |
... sort ignoring case | The default is to sort considering A/a case, but enabling this will ignore case. |
... sort descending order | The default is to sort from A to Z, but enabling this will reverse the sort order. |
Italics <i> | Use <i> </i> tags around the content. |
Bold <b> | Use <b> </b> tags around the content. |
Preformatted <pre> | Use <pre> </pre> tags around the content, as you might surrounding code etc. |
HTML prefix | Begin with any HTML code or opening tags like <b><i><em> etc., before the content. If the file does not exist then this prefix is not shown, so this may be used for headings or introduction text. Note: any opening prefix codes here should be closed in the suffix field below in reverse order. |
HTML suffix | Follow with any HTML code or closing tags like </em></i></b> etc. after the content, if it exists. If the file does not exist this suffix is not shown, so it may also be used for captions below the content. Note: any opening prefix codes in the field above should be closed in reverse order here. |
Add line breaks <br /> | Add <br /> tag to the end of each line read from the file. |
Add line numbers | Choose the style of line numbering to use or None to disable this feature (the default). |
Check out examples of Cat …
Example 1: the content below is a file in the RW resources area, and contains plain text with Markdown. Whenever the resource file changes, any Cat Stack pointing to it will also change!
Markdown Example
This content is from a file containing Markdown.
In a single file you can mix:
- plain text
- HTML
- Markdown
Example 2: the Cat Stack is also useful for dumping the contents of any file, preformatted in this case …
"1","English","Hello" "1","French","Bonjour" "1","Spanish","Hola" "2","English","One" "2","French","Une" "2","Spanish","Uno"
Example 3: the Cat Stack can dump another URL file (this is the first 15 lines of Google’s robots.txt file - scrolling courtesy of Joe Workman’s Static Height Stack). This example shows the Search option which is used to filter only the “Allow” lines from the file and disregard the rest, the Sort option which can be used to re-order lines, and the Max output and Line numbering options …
1) Allow: /?gws_rd=ssl$
2) Allow: /?hl=
3) Allow: /?hl=*&gws_rd=ssl$
4) Allow: /?pt1=true$
5) Allow: /books/about
6) Allow: /books?*q=editions:*
7) Allow: /books?*q=related:*
8) Allow: /books?*q=subject:*
9) Allow: /books?*zoom=1*
10) Allow: /books?*zoom=5*
11) Allow: /booksrightsholders
12) Allow: /m/finance
13) Allow: /search/about
14) Allow: /search/howsearchworks
15) Allow: /search/static
2) Allow: /?hl=
3) Allow: /?hl=*&gws_rd=ssl$
4) Allow: /?pt1=true$
5) Allow: /books/about
6) Allow: /books?*q=editions:*
7) Allow: /books?*q=related:*
8) Allow: /books?*q=subject:*
9) Allow: /books?*zoom=1*
10) Allow: /books?*zoom=5*
11) Allow: /booksrightsholders
12) Allow: /m/finance
13) Allow: /search/about
14) Allow: /search/howsearchworks
15) Allow: /search/static
Example 4: the Cat Stack is not an iframe, but it can dump another URL file, limiting the content to what is found within body tags …