The Vermont Paddlers Club

Meet new friends, and paddle better!
Ensemble - 2011


When passing arguments to a [shortcode] e.g. date_div $d="12/5/2012", $f="H:i:s", the string values passed must be contained in double quotes not single quotes. Variable names can be as short as 1 character, e.g. $d = ... If passing integer values or true or false, omit the double quotes.


Table _jazz_cache was created with entries for each existing page populated using the following query: "INSERT INTO _jazz_cache SELECT ID as page_id, id, 'under construction...' AS cache FROM _jazz". This table is also going to need a DATETIME 'sunset' column, so that each cache or snapshot of each page will auto-refresh at the appropriate interval. All of this is designed to cut down drastically on page build time when the GoDaddy PHP engine is bogged down for reasons the VPC webmaster cannot foresee or control...


Importing character entities like & nbsp; or & copy; with documentFragment->appendXML() - part of the PHP domDocument library - will throw errors unless these character entities have been explicitly declared by amending the DTD as in:
  1. <!ENTITY copy "& copy;">
  2. <!ENTITY nbsp "& nbsp;">
  3. <!ENTITY iexcl "& iexcl;">
  4. <!ENTITY yuml "& yuml;">
  5. <!ENTITY cent "& cent;">
...OR UNLESS we run the imported HTML through a pre-processor that finds and replaces all such entities with their numerical equivalents (e.g. & copy; becomes & #169;). Since the PHP domDocument library doesn't permit me to add any entity references explicitly to the DTD, I have written the necessary preprocessor, named: xml_entities(). My thinking is that it make the most sense to run the HTML through this preprocessor BEFORE saving anything to the database, which should make all the stored HTML snapshots and/or versions XML safe upon retrieval. The trickier part is with retrieval/display of legacy database entries e.g. from the message board that most certainly do contain some XML unfriendly character entities in need of conversion. For more on this see: Proposed Entitiies and preg_replace_callback.


A long overdue correction for the message board tables (all 5 of them) is to create a msg_uid column and a parentID column for each (done) and then to populate that second column with the proper parentID, making use of the datestamp column 1:1 relationship that already exists between parent:child messages in each table. The query below is a start:
SELECT messagesww.msg_uid, messagesww.datestamp, messagesww.parentM, messagesww.parentID, msgs2.msg_uid
FROM messagesww
LEFT JOIN messagesww msgs2 ON messagesww.parentM = msgs2.datestamp
WHERE messagesww.parentM <> '0000-00-00 00:00:00'
AND NOT ISNULL( msgs2.msg_uid )
ORDER BY `messagesww`.`datestamp` ASC
Below is an example of the query that gets the update done:
UPDATE messagesww msgs
INNER JOIN messagesww msgs2
ON msgs.parentM = msgs2.datestamp
SET msgs.parentID = msgs2.msg_uid
Simply build/run the UDPATE query above 5 times, for each of the 5 message board tables (messages, messagesdmt, messagesqw, messagesrc, and messagesww.


Copy/Paste from a WORD document to XHTML requires some manual tweaking in most instances, since WORD even 2010 contains lots of extraneous markup and character entities like the ellipse & tippil ; that the XMLDOM doesn't understand. With a little patience it can usually be done.


There are a couple of things to watch for when textnodes are inserted into the DOM. For one thing, an node's nodeValue is non-standard (a PHP convenience), so avoid the use of: $obj->nodeValue = "";as much as possible. One big reason is that PHP will NOT throw an error if you try to set nodeValue on a non-object.
The other thing to keep in mind is that the code indenting feature in PHP's domDocument$this->xhtml->preserveWhiteSpace = false;
$this->xhtml->formatOutput = true;
doesn't seem to bother to indent textNodes, so once you add a textNode to an element, whether you do it using ...->nodeValue = or ...->appendChild() or ...->insertBefore(), the code indenting feature is NOT applied to it.
SO IN GENERAL, AVOID (e.g.): $this->getEl("build_report")->nodeValue = "Build time: {$time3} seconds."; AVOID (SPECIFICALLY) CLEARING A NODE'S CONTENTS AS FOLLOWS: $this->getEl("content")->nodeValue = ""; PREFERRED METHOD FOR ADDING TEXT TO AN EXISTING NODE: $this->getEl("build_report")->appendChild( $this->xhtml->createTextNode("Build time: {$time3} seconds.") );


When a page like the Bow and Stern Archive, or the Limerick Contest want/need to display markedly different content depending on which $_GET/$_REQUEST variables are passed, there are 3 main things I can/will manipulate. One of them is the custom privilege/permission level that may need to be applied, for example everyone/world may read limericks but only members-in-good-standing may compose a limerick. I also in the Bow/Stern Archive show how the breadcrumbs can be custom modified, and the H2 element.


On the legacy site, I see (or don’t see) what Chris mentioned, namely the absence of a tweet from AJ based on his message board post that he purportedly flagged. This is an unexpected glitch I will need to investigate - as time allows. Technology is great...til something breaks.


On the legacy site, each record in the trips/events table has a 'tweeted' date field, which starts out empty/null. When a visitor to the website displays the trips list that page contains code which checks the table to see if there are any upcoming events that have yet to generate a self-promoting tweet, and if so then the self-promoting tweet goes out auto-magically. Then, as you would expect, the 'tweeted' flag for that/those events gets updated in the table to avoid multiple auto-tweets on a given event. This will need to be preserved in the new site.


The auto-magic process (working through Sept 2012 but possibly broken in 2013 for reasons I can’t explain) in which our Facebook page and our VPCNews twitter account were linked will need to be fixed/preserved.


For reasons I can't fathom, the nesting of code that normally occurs when PHP's DomDocument outputs a built page sometimes fails. A good example of this in on the landing page for pool sessions. I wasted a lot of time the past 24 hours trying and trying to peel away content/nodes to see if I could get theto nest and failed, and after a while you just shrug your shoulders and give up. It's all still valid XHTML, it's just ugly in code view.


FULLTEXT search is extremely useful but tricky. I first got it working on the Paypal reconciliation page in an AJAX call, where firstname/lastname/email are the only MATCH() fields. That worked beautifully. However, when I tried adding the phone, city, or street1 fields in an AJAX call in "Manage the Roster" the PDO engine balked. I finally discerned it's b/c FULLTEXT MATCH() insists that the collation on all the fields in the fieldlist be the same, but in some tables/rows (100+ rows) the collation was still latin1_swedish_ci. So, I backed up the DB and followed the advice here (, which I am hoping will let me finish the work on "Manage the Roster" and also apply a similar search methodology in a "Lookup" tab on "Paddler to Paddler", something Paul Carlile in particular misses...


The use of $_SESSION['location_trail'] to resort/redirect to the last "valid" page after the login or logout page has been accessed is unsophisticated, in that we store there only the integer value of $_GET['id'], and not the entire $_SERVER['query_string']. There are only 3 pages on the site where we find references to $_SESSION['location_trail'] (index.php, SMART_FORMS_2038.php, and enable_login_form_new.php. At some point perhaps we will want to make these redirects more sophisticated.


When in the page editor (id=123) with the needed admin privileges, there are too many button choices at the bottom and at least one of them: "Save" does not work, it just does a print_r() from SMART_FORM_2038.php


We finally have nailed down a method by which page content living in dom_assets/shortcodes delivered by AJAX (whether JSON or XHTML) demands authentication. Not every AJAX enabled page will need this, but many will/do. The functions.php top-level page now contains: function authenticate_ajax_user($jz_privileges) {} which will "Uh oh..."/exit when $_SESSION['user']['my_access'] is not set. A list of shortcode pages so enabled follows:
  1. Paddler to Paddler (22)


Best practice for echo'ing well-formed XHTML using AJAX, is demonstrated in: shortcodes/paddler_to_paddler.php. Essentially we populate the <root></root> node (a.k.a. $doc->xhtml->documentElement) of a stripped down domDocument with a single child node that contains everything we've dynamically built, then...

	$doc = new DOC_SHELL();
	list($firstchild) = stuff_stuff_oop(
		array("div")  // OR "span" OR "p" OR EVEN "table"
	echo $doc->xhtml->saveXML(

Please log in.
For Username, enter either 1) the primary email address you've specified in your member profile, or 2) the Username assigned to you upon joining the VPC.

Once you are logged in as a VPC member, you will have access to your member profile, and members-only content on the website. If your login attempts fail, please email the webmaster. Include your name, and (if you know it) the username you were assigned.

red code
Link Checker Valid XHTML 1.0 Valid CSS
© 1996-2017 The Vermont Paddlers Club
Report a Bug