Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/jackbor/public_html/blog/wp-content/plugins/headmeta.php on line 52

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/jackbor/public_html/blog/wp-content/plugins/headmeta.php on line 52

WordPress Plugin - Safe Include

Safe Include by Jack Born is a new Word Press plugin that is an off-shoot of my other plugin, staticJack. Both of these plugins are meant to make the job of adding static content to your Word Press blog simple, safe, and quick.

The really cool thing about Safe Include is the way in which you can write a post or page and just pop a {{placeholder}} in the body and bam… static content is added to the page or post.

If you want the static content to make up the entire post, then just use the placeholder alone. If you are using a static “block” of content (a contact form, or a short snippet of server side code) that you want to inject into the middle of a post, then this lets you do it.

Plus, this new plugin lets you go right into the code of your theme and inject static content wherever you want, in much the same way.

Easy to install and even easier to use.

If you like the code I want you to do two things

  1. Link back to me with a short post about the plugin
  2. Sign up for my update newsletter so I can announce new plugins and non-WP projects that I have in the pipeline. You’ll also get notifications about plugin updates.

Your Name:

Your E-mail Address:

Download “Safe Include” by Jack Born

17 Responses to “ WordPress Plugin - Safe Include”

  1. Tyler says:

    Nice plugin, though I had to hack it up a bit to make it work like I wanted it to. Basically, I was looking for something that would go and grab the output of any page from the safeIncludes folder instead of only html or php. This would allow me to code a page in python and include its output. If you’d like to see the changes let me know and I’ll send them to you.

  2. Jay says:

    Just a question, If I have 10 static html pages linked all together, no header nothing just tables with contents. And want it to load in wordpress template, would this script work too? and is there anyway to make the links between my static 10 files work all around? Thank you

  3. Jay says:

    And i got no idea why the script isnt working, i have did the main steps, installed the plugin, created the safeIncludes directory in the themes folder, placed the files in them, created a post, placed {{test1}} as my file inside the safeIncludes test1.htm and it shows nothing on the page. i am using wordpress 2.0, does you script have anything to do with the .htaccess? cause it’s weird its not working, what worked is the which we can use without any script. please can you tell me if i am missing anything? regards

  4. Administrator says:

    Turn debugging on:

    define(’_DebugCode_’, false);/*true = show include path :: keep false unless you are debugging!*/

    change to

    define(’_DebugCode_’, true);/*true = show include path :: keep false unless you are debugging!*/

  5. alby says:

    correction
    If I insert 2 files inner folder safeIncludes
    so:
    page1.htm
    page2.php

    and the setting is
    AllowedSuffixes_’, ‘.php|.htm|.html’)

    work only page2.php

    but if I change
    AllowedSuffixes_’, ‘.htm|.php|.html’)
    work only page1.htm

    so work only the first suffixes;

    another:
    in the page1.htm I not see the image (same problem
    of the other your plugin static)

  6. Administrator says:

    Changing the order of the suffixes changes the order in which the plugin looks for your pages. If you start with .htm then it first looks for a page with .htm

    If it finds a page with .htm then it won’t continue searching.

    The image issue can be fixed by fixing your html.

    Instead of src=”image.gif”

    Try src=”/dir/to/image.gif”

  7. alby says:

    So If I insert 2 files inner folder safeIncludes
    so:
    page1.htm
    page2.php
    and the suffix is … ‘.htm|.php|.html’)

    and I have 2 link at their pages
    link 1 page1, is page1 with code {{page1}}
    link 2 page2, is page2 with code {{page2}}

    I see only page1?
    If so I can create only a list of link that can use only same extension (no mixer extension);
    if is so then the correct name of
    AllowedSuffixes
    would to be
    AllowedSuffixesOnlyOneForTime
    ————–
    regard 2nd point
    I have this
    safeIncludes/page1.htm
    safeIncludes/page1_file/image.gif
    and the src is:
    src=”page1_file/image.gif”
    the link is correct:
    work if I click direct ther file page1.htm;
    not work with safe-include;
    I have tested also url absolute
    but not work.
    any idea?

  8. Administrator says:

    Alby,
    It’s generally not a good idea to suggest that I rename my constants within my code if you are looking for free help. It’s condescending — and beyond that, incorrect.

    Here’s the deal:
    The way my plugin is currently written, if you have “foo.htm” and “foo.php” on your server then there’s a potential name collision. To avoid the confusion, my plugin looks for files with the extensions listed in AllowedSuffixes in the order in which you list them. If you put .htm first, then it will grab foo.htm and disregard foo.php. If you put .php first, it will grab foo.php and disregard foo.htm.

    Now…

    If you have no name collision: you have foo.htm and bar.php on your server… then my plugin will find BOTH files.

    Second point…

    You should not put image files (or javascript, or css, etc etc) inside of the safeIncludes directory.

    Why?

    Because this is supposed to be the directory where my plugin goes looking for ‘include’ files… not images, not js, not css.

    (You could make it work as you currently have it by changing your link to src=”/wp/safeIncludes/image.gif” where wp is your actual wordpress directory, whatever you are using)

    I recommend you have an image folder in the public root of your server (”/images”) and you put your image files there. Then, in page1.htm you could have an image link such as src=”/image.gif”. Please note the leading slash. It’s important.

  9. John Brackett says:

    I used the debugging tool and received the following error. I’m using IIS6 and PHP 4.3 and all other .PHP file are readable. Any Ideas?

    d:\Inetpub\vhosts\themoneyhelper.com\httpdocs\wp-content/safeIncludes/home_exerpts.php.php is iPath
    d:\Inetpub\vhosts\themoneyhelper.com\httpdocs\wp-content/safeIncludes/home_exerpts.php.htm is iPath
    d:\Inetpub\vhosts\themoneyhelper.com\httpdocs\wp-content/safeIncludes/home_exerpts.php.html is iPath

  10. Lozbo says:

    Dame Jack, you don’t know how much time i wasted on trying to get a plug in like this… Thank you very much! I just don’t understand why wp is not allowing the correct (standard strict xhtml) markup for a table stay as is;

    I use this structure:

    table
    thead
    tr
    th
    tbody
    tr
    th
    td

    And wp keeps taking out some closing tags I dont know why. Anyway with safeInclude I manage to display it correctly. Thanks again very much!

  11. Drew Decker says:

    I was wondering… if I do the static pages…can i use the “pages” to do static pages…or do i have to stick with the “post” option (wordpress: write > post) ..

    Also, if I have to do the “post” option, will it had my static posts…since I do use a “recent posts” plugin…and i don’t want it to display a static page as a recent post…

    thanks.

  12. paul says:

    Trying to get this working: here’s what debug says. 

    /opt/www/wordpress/wp-content/plugins/safeIncludes/zeitgeist.php is iPath
    /opt/www/wordpress/wp-content/plugins/safeIncludes/zeitgeist.htm is iPath
    /opt/www/wordpress/wp-content/plugins/safeIncludes/zeitgeist.html is iPath

    the file exists:
    file /opt/www/wordpress/wp-content/plugins/safeIncludes/zeitgeist.html
    /opt/www/wordpress/wp-content/plugins/safeIncludes/zeitgeist.html: UTF-8 Unicode English text, with very long lines

    Hmm, never mind. I added .txt to the AllowedSuffixes, changed the filename and hey presto. 

    Thanks, Jack. 

  13. a crank’s progress » WordPress, Pages, and php includes says:

    […] It has been a long time coming but I finally found a way to integrate static content into WordPress’s Pages. Pages with a P are like posts but exist outside their time-based organization. […]

  14. Todd says:

    Hi. I am trying to include the page www.iscramla.com/plogger in my wordpress layout. Will this plugin work, and if so, how?

  15. Caroline says:

    Hello Jack, question for you…what about pulling the blog contents onto a static web html page? Can the plug in do that? I need to dynamically replicate the headlines from the three most recent posts to the blog, on my homepage, index.html. Suggestions welcome!

  16. Ian Heggie says:

    Plugin works well. I changed the match pattern to match only safe file names:

    define('_MatchPattern_', '/{{([A-Z0-9][-\._ A-Z0-9]*)}}/iU');

    Thanks again,
    Ian

  17. Ian Heggie says:

    Mmm… having justify on spaces out the code … there is only one space after the comma, and between the underline and A-Z.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Calendar

January 2006
M T W T F S S
« Jun   Mar »
 1
2345678
9101112131415
16171819202122
23242526272829
3031