Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2008-10-28 13:30:10
- pepebe
- Member
- From: Mannheim, Germany
- Registered: 2005-02-07
- Posts: 74
Articles and Code
Hi everybody,
I’m just about to publish my new site featuring zem_event_reloaded. A collection of new functions for the zem_event plugin. While writing on the documentation I encountered obstacles far worse then a few hundred lines of code…
I have to write a couple of articles showing how to use the plugin. Yet I found out that writing code, especially text pattern tags as well as html syntax is extremely difficult. Textile doesn’t seem to help.
How can I tell textpattern to ignore textpattern tags? More important how can I style my code THE WAY I LIKE without textile doing WHAT IT WANTS. Perhaps I’m just stupid about that particular aspect.
Do I need a plugin? Do I have to write one?
Please, tell me I’m wrong and it is easy to do.
Greetings,
pepebe
Offline
Re: Articles and Code
You could simply disable textile for that particular article under the “Advanced Options” tab on the “Write” page or use surrounding ampersands “@” which can be around a phrase within text or as a block where you can use line-breaks but can’t leave a blank line then style the output in your CSS.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#3 2008-10-28 16:23:03
- pepebe
- Member
- From: Mannheim, Germany
- Registered: 2005-02-07
- Posts: 74
Re: Articles and Code
Thx thebomsite,
this is what I tried before and it felt awfully clumsy. After thinking a bit more about this problem I came up with two possible solutions.
1. Externally encode code in html entities and paste it into the article. Put a <code><pre></pre></code> arround it and voila! This has the benefit of converting all kind of code (html, php, txp) into a format that will look beautiful in any browser. Perhaps there is even some kind of application arround doing exactly that kind of stuff ( even colorizing it?).
2. Write a small plugin. I did some tests with this baby:
<?php
function ppb_displaycode($atts, $thing='') {
extract(lAtts(array(
'class' => '',
), $atts));
if ($thing) {
return '<code class="'.$class.'"><pre>'.htmlspecialchars($thing).'</pre></code>';
}
}
?>
It is a container tag. You can call it from within an article.
Example:
<txp:ppb_displaycode>
<p>This is a paragraph</p>
<p>This is another one</p>
Some empty space between two lines
<p>And a last one</p>
</ppb:_displaycode>.
It works well with php, html and textpattern stuff.
I only found one error. If you write a line like this:
<txp:ppb_displaycode></ppb:_displaycode>.
It causes a strange misfunction.
I will do some research on this topic after the initial launch of my site.
Cu,
pepebe
Last edited by pepebe (2008-10-28 16:23:57)
Offline
Pages: 1