Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [xpert] Postcards Plugin Available -- soon

Quote Reply
Re: [xpert] Postcards Plugin Available -- soon In reply to
Hi,

This is not *technically* a plug-in.

It's more of an add-on, written in perl.

It's actually *completely* stand alone, *except* it uses the Links SQL engine for database access, parsing, etc. It *never* has to read any Links table, write to any Links table, or access any Links data -- unless you want it to :)

The only thing it does is check the Plugins registry to get the name of the POSTCARDS table it installed (and maybe later on the expire times and such). (I'm using the plugin format also to make it easy for people to install and have the tables set up for them and files put in the right places.)

What this means, is that it doesn't need to run in PHP. The perl script simply acts as the go-between the web browser and the database, and if you like, you could pretend it was a php .lib file, and ignore it.

You just edit your templates. Because it uses the links parser, you can <%include%> any tags you want, call functions, etc without ever editing the script! The script only looks for certain tags you send it from the templates.

Your users will see postcards.cgi as the url, rather than postcards.php, but once they click back into your site, they'll be seeing .php files again.

In many ways this is easier than PHP, since you don't need anything but standard HTML and <%links_tags%> in your template files to control the program.

That said, the POSTCARDS database is free-standing (it requires, relies on, and links to *NO* other tables), so if you wanted to, you could access the database via PHP for card pick up, for example, and still use the perl code for creating the card.

Just remember, the perl script does a lot of other stuff -- checking for notification sending, updating the number of views, and such (this was added so that my parents could send a card to a classmates mailing list, and see how many people picked up the card, etc). Rewriting it in PHP would need to take all that into account, if you wanted to use those features.

This code got killed in the crash, but I will add it in, since they still want it. Basically, it allows creating a card, and specifying a template, then sending the pickup notification out in your email. It's an enhancement so that not only can a user send their own photos, they can use their own templates. There is no email address, since multiple people will be checking the card.

The postcards script obviously runs in dynamic mode, so jumping back to PHP is only a matter of putting the right links in your templates.

I know this is a tough thing to try to explain, but this script *really* is completely template driven!

In a way, it functions as a stripped down PHP engine (it's sort of how PHP started out). All it does is parse a set of input tags, and do something with them, using certain tags to control behavior such as dates, next template, preview, etc.

Maybe this will help a bit:

Code:
<FORM method="POST" action="<%db_cgi_url%>/postcards.cgi">
<INPUT type="hidden" name="BgColor" value="<%BgColor%>">
<INPUT type="hidden" name="cClosing" value="<%cClosing%>">
<INPUT type="hidden" name="cGreeting" value="<%cGreeting%>">
<INPUT type="hidden" name="Closing" value="<%Closing%>">
<INPUT type="hidden" name="Do" value="postcards_preview">
<INPUT type="hidden" name="ID" value="<%ID%>">
<INPUT type="hidden" name="LinksID" value="<%ID%>">
<INPUT type="hidden" name="Greeting" value="<%Greeting%>">
<INPUT type="hidden" name="Msg" value="<%Msg%>">
<%if column_name%>
<INPUT type="hidden" name="column_name" value="<%column_name%>">
<%endif%>
<%if URL%>
<INPUT type="hidden" name="Picture" value="<%URL%>">
<%endif%>
<%if Picture%>
<INPUT TYPE="HIDDEN" NAME="Picture" VALUE="<%Picture%>">
<%endif%>
<INPUT type="hidden" name="TColor" value="<%TColor%>">


This is how you control and pass information into the script.

I've been changing the templates to use postcards_ prefixes, since trying to get Links to use alternative subdirectories is flakey at best, and template crashes are starting to happen with all the plugins.

You can add any tags you want, just make sure to pass them through from one template to the next, unless they are part of the Links globals. The only required ones are URL, do, and the to/from email address. The rest of the tags depend on what your templates need -- and can be almost anything.

The URL tag is what image to display.

The do tag is what the next template (or command) to execute is.

The rest of the tags are just ordinary tags, that influence the HTML, the fields in the database, or whatever.

If there is a database field that matches one of the input tags, it will be stored in the database.

Really, really simple (I hope!!)


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Subject Author Views Date
Thread Postcards Plugin Available -- soon pugdog 6146 Jul 10, 2002, 10:42 PM
Thread Re: [pugdog] Postcards Plugin Available -- soon
pugdog 5948 Jul 10, 2002, 10:47 PM
Thread Re: [pugdog] Postcards Plugin Available -- soon
xpert 5935 Jul 11, 2002, 1:21 AM
Post Re: [xpert] Postcards Plugin Available -- soon
Andy 5922 Jul 11, 2002, 2:08 AM
Thread Re: [xpert] Postcards Plugin Available -- soon
pugdog 5902 Jul 11, 2002, 2:36 AM
Thread Re: [pugdog] Postcards Plugin Available -- soon
Ian 5924 Jul 11, 2002, 7:45 AM
Thread Re: [Ian] Postcards Plugin Available -- soon
Teambldr 5895 Jul 11, 2002, 9:33 AM
Post Re: [Teambldr] Postcards Plugin Available -- soon
Ian 5922 Jul 11, 2002, 9:35 AM
Post Re: [pugdog] Postcards Plugin Available -- soon
pugdog 5828 Jul 12, 2002, 9:13 AM
Post Re: [pugdog] Postcards Plugin Available -- soon
pugdog 5840 Jul 13, 2002, 9:57 PM