Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Unique idea: Possible to pull body text and use in article form?
Hey, was looking for a little assistance on a bit of unique issue I have.
I want to be able to pull the body copy from an article and use it in an article form at the same time.
Thus the article form structure would look like:
- title
- body copy
- date
- body copy 2
The reason being these are blockcode snippets, bc. <a href="">link</a>
for example.
I need the second version to be without the blockcode snippets. Is this doable, advisable, is there a better way?
All thoughts, ideas and/or help is appreciated!
Sam Brown
sambrown.me | welovetxp.com
Offline
Re: Unique idea: Possible to pull body text and use in article form?
Have you considered using the excerpt field for body copy 2?
Offline
Re: Unique idea: Possible to pull body text and use in article form?
Hey ruud,
I hadn’t considered the excerpt field, that’s a great idea.
The only issue then is the pre-populated 150+ articles that don’t have the excerpt code in place.
Sam Brown
sambrown.me | welovetxp.com
Offline
Re: Unique idea: Possible to pull body text and use in article form?
Sam, I guess you must have something in your body copy that marks where the break should occur?
If you have something like that, another way might then be to use — or adapt — one of the plugins that replace text strings with something else (usually used for smilies or stuffing foul mouths) and use this to insert the date and a </blockquote><p><txp:posted /></p><p>
… into the middle of your body copy.
TXP Builders – finely-crafted code, design and txp
Offline
Offline
Re: Unique idea: Possible to pull body text and use in article form?
Hi Guys,
Those both sound like good ideas, however it’s not that I am trying to insert the date earlier, but what I actually want to do is reuse the body copy that is already in place for the 150+ articles.
I want to be able to pull that same data again in the same article form but use it slightly differently.
Here is an example:
<h2>How to create a link</h2>
<pre><code><a href="" title="">Link text</a></code></pre> <!-- Current body copy -->
<p>Date & Author</p>
<p>Example: <a href="" title="">Link text</a></p> <!-- Body copy used again, minus code tags -->
Ruud suggestion of using the excerpt would work fine from now on, but editing the 150 articles would not be much fun. Is this the best way?
Sam Brown
sambrown.me | welovetxp.com
Offline
Re: Unique idea: Possible to pull body text and use in article form?
And using <txp:body />
twice over, while using one of the replace plugins to replace bc.
(or <pre><code>
etc. depending on what field it parses) with nothing, effectively scrubbing them out?
Alternatively, if you had your body copy without the bc.
in it (and set not to use textile) you could simply call txp:body
twice wrapping the first instance in <pre><code>
and the second precede with example how you want to. You’d need to change your articles but you could probably batch clean those codes from your articles and do the “set to not use textile” directly in the database with a few SQL commands.
Both approaches depend on whether this is the only difference…
TXP Builders – finely-crafted code, design and txp
Offline
Re: Unique idea: Possible to pull body text and use in article form?
Hi Jakob, yes, this is the only difference. I have a feeling that mass SQL queries is probably the best way to go, but I may look into a replace plugin.
Thanks for your thoughts, will let you know how it goes.
Sam Brown
sambrown.me | welovetxp.com
Offline