Hiding default links on the Textpattern 'write article' page
On both a recent and a current project involving the Textpattern CMS, I have found that I needed to hide parts of the default article creation page (content > write) to avoid any confusion on the part of client users.
I thought I had found the solution in the waz_admin_hide_fields plugin, which allows you to specify which links and/or page areas you want to hide (e.g. “Textile Help”. “Recent Articles”, etc.) – but it has an unfortunate side-effect.
It hides the links by re-writing the code after the page has loaded to insert “display: none;” into the relevant paragraph and input tags, but this also has the unwanted effect of re-arranging the layout of the page, and causes the contents of the main article textarea to add line-breaks where they are not wanted (see illustration).
Hacking the PHP
The only alternative solution I could come up with is to hack the PHP itself. You’ll need to open up the include/txp_article.php file in your text editor of choice, and find the section that starts:
//—textile help———————
It’s around line 396 in RC5.
Then simply comment out the links and options that you don’t want to have appear; they are all pretty well commented, so you shouldn’t have any problems locating the right bits.
You can either comment out the PHP itself by adding two slashes at the start of each line, or add SGML style comments (<!-- -->) inside the quotes that will be output to the page.
Not the most elegant of solutions I admit, but pretty easy even for a PHP novice. Don’t forget though that if you upgrade your Textpattern installation you’ll probably overwrite your changes, so you’ll have to do it again.
Update 07/08: I’ve just discovered a slight problem if you comment out the two checkboxes relating to ‘Use Textile’ – it removes all formatting from your article body!
You can get around this by replacing the relevant code with this auto-textile-enabling snippet:
'<input type="hidden" name="textile_body" value="1" /><input type="hidden" name="textile_excerpt" value="1" />',
Filed under: Textpattern.
Bookmark this article with del.icio.us
Previously: Degrees of Seperation
Next: Order by numeric values in SQL
Comments
- Nathan Pitman
- 1128 days ago
- Great tip Matthew. Thanks!
- #1
- Matthew Pennell
- 1125 days ago
- Most definitely, Stuart – almost all of my project files have a decent number of .php.original files in there, testament to my need to fiddle! ;)
- #3
- Matthew Pennell
- 1125 days ago
- Ooh – can it finally be true?!
- #6