The Hickensian
20.09.04 Textpattern notes part 4
A few more Textpattern odds and sods.
Finishing off the hacks to the comments.php file in Textpattern (see also TXP notes 3)textpattern-notes-part-3 is the introduction of a small feature from MovableType that I miss. When receiving email notifications of comments, they always had the relevant entry URL in them. You see the comment and want to reply, so just click the link to go straight there.
Here’s how to do this in TXP. In publish/comment.php find this line near the end (should be line 374 if you haven’t already hacked it):
<pre>
$out = "Dear $RealName,\r\n\r\nA comment on your post on your post \"$Title\" was recorded.
</pre>
Change it to this:
<pre>
$out = "A comment on your post \"$Title\" (http://www.sitename.com/blog/$parentid/ ) was recorded.
</pre>
Just change the URL to suit your site, and the parentid will add the relevant id into the URL. Incidentally, if you’re upgrading textpattern to the latest RC, and you’ve installed these hacks, then you just need to change 1 line of code in order to keep your customised version.
***
Integrating Textpattern with Photostack was another goal. I wanted to keep all my ‘include files’ (footer, navigation etc.) as forms within Textpattern, as this makes life so much easier. However, I also want to insert these in pages outside of Textpattern. To do this, open up the index.php file in Photostack, and change the small chunk of php to read:
<pre><?php
// include Textpattern first
include '/full/path/to/textpattern/config.php';
include $txpcfg['txpath'].'/publish.php';
ob_start('parse');
// Then pull in the photostack.php program.
include("photostack.php");
// Load photostack.
load('config.php');
?>
</pre>
And then all your Textpattern tags, such as <txp:output_form="header"> will parsed. This also works for static pages.
***
One of the shortcomings of Textpattern that I mentioned previously, no control over the XHTML output in permalink tags, has been solved by this excellent plugin by Zem. It allows attributes such as class and title to be specified. Nice.
***
Finally, I’ve only recently discovered what ‘override form’ in content>write>advanced options can be used for. I now have 2 forms for using with entries, a default one which only displays an excerpt on the main journal page (for long entries), and another which displays the full entry (for very short entries). I can then choose to override the default when posting or editing an entry for instance, when the entry is short. If the option to override form isn’t visible (under ‘Advanced Options’), the you may need to open up textpattern/lib/admin-config.php and change the ‘allow_form_override’ to equal 1.
Recent Posts
17.02.10 A new global visual language for the BBC's digital services
17.02.10 Moving on
11.02.10 Zootool
26.01.10 The Handbag has been raised!
22.01.10 Guide to the Internet (2000)
Or Full Archives
The Hickensian is the journal of Jon Hicks, one half of the creative partnership Hicksdesign. Read more about us.
playlist
My Zoo | RSS
Contact
Hicksdesign
Island House
Lower High Street
Burford
Oxfordshire, UK
OX18 4RR
+44 (0)7917 391 536
I am currently looking for new projects from June 2010 onwards
10 comments
Journal RSS Feed





Download vCard
Comments | RSS
∞ Hans said 1998 days ago:
Thanks muchly once again. I plan to make Photostack my slave for making thumbnails of my photos on my archives page once I start my photoblog. (One heck of a sentence…)Question: Wouldn’t email notifications clog up your already clogged-up inbox? Even I, with practically no viewers, don’t use ‘em simply because they’re irritating. Oh well, to each his own. Then again, it’ll probably save the Urchin from counting your visits.
∞ david said 1998 days ago:
Your current email notification code gives the URL with just the ID.But if I change the code to:
. . . sitename.com/blog/$parentid/$Title/
It will output: /journal/577/textpattern-notes-part-4/
Right?
∞ Gerrit van Aaken said 1998 days ago:
I hope you have a good changelog. All those hacks and extensions: Upgrading to 1.0 must be very – exciting.∞ Jon Hicks said 1998 days ago:
Hans – absolutely! Its not irritating at all, and lets me know if anyone is saying anything rude!David – should do, but you shouldn’t need it. All TXP needs is the ID in order to find the entry.
Gerrit – Upgrading to the RC was pretty painless actually – I was pleasantly surprised!
∞ Jeremy Amos said 1997 days ago:
Out of curiosity, had you pulled your hacked comment.php out into an include? I noticed that Dean saved you the effort of playing with FileMerge :)∞ Charles Roper said 1997 days ago:
Is it just me or have the styles gone AWOL here? A TXP upgrade issue perhaps?∞ Hans said 1997 days ago:
Hmmm.. for some reason, the “easy reading version” is being turned off by default. Not good.∞ Jon Hicks said 1997 days ago:
Sorry folks, I’ve been fiddling with the style switcher, trying to implement a new system – didn’t work though.Hans – Easy reading version should be off by default, but the link to change to it should be visible and clickable. Let me know if that isn’t the case.
∞ head zoo keeper said 1997 days ago:
i hit your site today and for some reason, the “easy reading” style sheet loaded by default but the link to change was indeed, easy to find an click. using safari 1.2.3, if that’s any help.∞ Marcus Hofmann said 1993 days ago:
Only barely related: I just realized your comments preview was not working in IE for Mac OS X. I had a look at the Javascript and I believe it should work if you use double-quotes (”) instead of single-quotes(’) like you currently do.