Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-08-18 20:02:36

Sam
Member
From: New York City
Registered: 2004-06-26
Posts: 127
Website

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!

Offline

#2 2008-08-18 23:51:54

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

#3 2008-08-19 08:15:01

Sam
Member
From: New York City
Registered: 2004-06-26
Posts: 127
Website

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.

Offline

#4 2008-08-19 08:31:58

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,729
Website

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

#5 2008-08-19 09:04:27

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Unique idea: Possible to pull body text and use in article form?

If i remember right, rss_auto_expert can cut/limit/offset paragraphs with it’s skipparagraph etc. attributes. So, with it you could possibly insert the date after the first paragraph.

Offline

#6 2008-08-19 09:28:34

Sam
Member
From: New York City
Registered: 2004-06-26
Posts: 127
Website

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?

Offline

#7 2008-08-19 12:32:24

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,729
Website

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

#8 2008-08-19 12:49:30

Sam
Member
From: New York City
Registered: 2004-06-26
Posts: 127
Website

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.

Offline

Board footer

Powered by FluxBB