Welcome to CG-Inline
A system for embedding custom 'dynamic' content into posts.
CHAITGEAR needed a system for embedding Amazon products, per-post images, and
site-post hyperlinks within a post, quickly and easily.
It's a hack, but one that works. It uses HTML-format comments <!-- --> in
order to bracket the macros/functions, and a custom format within the comments to
activate the 'commands'.
PLEASE Help CHAITGEAR
If you find this code useful, please give us a link back from your site.
Go to the About CHAITGEAR pages, grab one of the cool link graphics and
sample title/alt text, and link to us!
Thanks!
INSTALLING CG-Inline
This documentation is in a state of flux!!
Copy cg-plugins folder INTO {your wp}/wp-content/plugins/ as a subdirectory.
Copy contents of plugins folder (well, cg-inline-plugin.php specifically) into
the {your wp}/wp-content/plugins/ folder.
Go into the Plugins interface and activate it.
USING CG-Inline
All CG-Inline macros/comments follow the form:
<!--{function}:{one}[.{two}][:{three}]-->
Note the {} is for showing things to fill in, and [] is for showing optional blocks.
Both are used here for visual sake only for the example, not part of the formatting
Function is one of: amazon, imgleft, imgright, permalink, pagelink.
AMAZON
Integrating with CG-Amazon, you can add any Amazon items to a post by specifying the ASIN/ISBN:
<!--amazon:B000002G3Y-->
<!--amazon:0380977095.link:one of my favorite books-->
<!--amazon:B00001QGQI.right:Small-->
Setting {function} as amazon tells CG-Inline to process as an inlined amazon product link.
{one} should be the Amazon ASIN or ISBN code (ISBNs are the ASINs for books) for the product.
{two} is a optional positioning/formatting flag. It can be empty (defaults to
style 'float'), 'left', 'right', 'inline' (all four cases of which result in CSS that you
can stylize), or a new hack flag 'link' (which results in a text-only link, for embedding in
paragraphs as text). Generally, you can leave it out completely (no period, nothing) unless
specifying the link case, or knowing you want to leverage specific CSS.
The CSS will be a class wrapped around the item: right==amazon-float-right, left==amazon-float-left,
or inline==amazon-inline, or no ".{two}" at all defaults to class amazon-float.
{three} is used as a text "title" for the case of a 'link' formatting case. for all other
format cases (including none specified), {three} is the size of product image to show. The default
image size if none is specified is whatever you've set in cga-config (or 'Medium' if you haven't put
anything), 'Small', 'SmallMedium', 'Medium', and 'Large' are the allowable size names. 'None' is also
allowed to show no image.
Other {function} tags:
imgright and imgleft: for floating images within a post. {one} and {two} must
both be used, to form a full image filename (i.e., "image.jpg" where img==prim, jpg==sec).
{three} is used to supply a custom title for the image.
meta: {one} should be the Meta/Custom tag name in the post data where you have stored your
customized information field. The field will be looked up and output inlined into the text
of the post. If :{three} is 'random', and the Meta tag has multiple entries, one single
random entry will be output. Otherwise, multiple entries for a given key will be all listed
separated by commas.
floatclear: {one} should be 'both', 'left', or 'right', and generates a DIV you can then do
CSS clear: styling on for a quick way to force spacing after floated post elements.
query: {one} should be a query system that can be given a word/phrase and look it up, and
then in :{three} you can give a word or phrase. That will become a hyperlink on the page
with the given text, linking to the query site to lookup infomation on that word/phrase.
The current query systems supported are:
google, yahoo, ask, wikipedia, answers, dictionary, imdb
Obviously, Amazon queries have their own system outlined previously in this doc.
permalink: {one} is the post-ID of a post to link to, and :{three} is required to
specify the link's text.
pagelink: {one} is the page number internal to a multi-page post to link to. No title needs
be specified if using our NamedPages extension (NOT YET AVAILABLE).
©Copyright 2003-2005, David Chait. All rights reserved.
NO WARRANTY
This library is free for use, WITH NO WARRANTY:
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.