This isn’t really so much a hack, I just didn’t know what else to call it. It’s more like just using the resources available to get a different behavior from Textpattern. The primary reason I switched back to Wordpress was because when my site went down, I couldn’t access any of my template information. The markup, most of the CSS, etc. was all housed in the database, and encrypted apparently, so I couldn’t even go into the database to get it.

So I’ve figured out a way around that, and maybe it’s not the best way, but it works. Definitely tell me if there’s a flaw to doing things this way. When I say it “works” I just mean I personally haven’t noticed any problems, but there may be some I don’t know about.

CSS Styles

The first thing I did the first time I lost CSS information in Textpattern was use “importto pull in a raw CSS file. I also prefer to use [Textmate][] to code, so this was a real treat instead of doing everything in atextarea` in the TXP admin area.

Inside the styles area, I create stylesheets as usual, attached to whichever sections I need them to be, and then in the style area, I import them: “import url(/css/style.php);`

You could also link them directly from the header area, but then you’d have to use <txp:if_section> to get it to work the same way.

Pages & Forms

To get markup into raw files is a little more tricky because you use a PHP include and PHP in TXP is a little tricky.

  1. First, I make sureAllow Raw PHP* is turned OFF andAllow PHP in Pages* is ON.
  2. Next, I create my raw files (txt, html, php, whatever) and put my TXP code in them just as I would in the admin fields.
    1. I create folders for pages and forms too, so I can keep them separate.
    2. These folders are in a parent folder called site_design, inside the textpattern directory. That way you can use txpath in a minute.
  3. Then, I set up my include using Textpattern’s code for PHP.


<txp:php>
    include(txpath.'/site_design/pages/section.php');
</txp:php>

Now I can use TXP tags from these “remote” files instead of keeping everything in the database and accessing it only from the TXP admin area. I just wish I’d figured out this last part before I switched to Wordpress because I would have stayed with Textpattern!

Note: I don’t put all the forms in include files because there are so many of them, and many times they don’t have much in them, so I usually just do forms which tend to have a lot of code in them, like the header, footer and sidebar includes.