Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-06-10 20:52:46

ReinierBiz
Archived Plugin Author
From: the Netherlands, Rotterdam
Registered: 2004-04-07
Posts: 42
Website

Custom Fields: rei_show_custom

Download as usual (right click, and ‘save as’)

rei_show_custom

Usage examples:

  • <txp:rei_show_custom />
    Shows the first custom field you have (custom_1)
  • <txp:rei_show_custom customid="2" />
    Shows the custom field ‘custom_2’
  • <txp:rei_show_custom customid="3" wraptag="p" />
    Shows the custom field ‘custom_3’ wrapped in an ‘p’ tag.

Ideas for some more features?


VC88 | Nah, there weren’t really eighty-eight of them. They just called themselves “The Crazy 88.”

Offline

#2 2004-06-10 21:43:49

misterk
Member
From: Morris, MN
Registered: 2004-02-24
Posts: 77
Website

Re: Custom Fields: rei_show_custom

Great plugin, thanks Reinier.

Is there a way that the plugin could be called from within another plugin? I am trying to have a list of books which I have read, and the ISBN of the book is in the custom_1 field. But when I use your plugin in the “read” form within the jcv_amazon plugin (to get the amazon data for each book), it breaks the plugin. It looks like this:

<txp:jcv_amazon searchType="ASIN" searchString="<txp:rei_show_custom />" form="amazon" limit="1" cacheTime="60" />

All it spits out is the jcv amazon plugin call after the <txp:rei_show_custom /> tag:

“ form=“amazon” limit=“1” cacheTime=“60” />

If you could help with this that would be great, otherwise I could just wait for Dean to implement this officially and hope it works then.

Last edited by misterk (2004-06-10 21:49:06)

Offline

#3 2004-06-10 23:02:39

marco
Member
From: Montreal
Registered: 2004-02-24
Posts: 62

Re: Custom Fields: rei_show_custom

Nice job! Could this somehow be used to simulate non-blog type posts, such as, say
a list of addresses using some of those custom fields?

Of course, one nice and innovative thing would be to have a custom form generator built in – that is, if TxP is to grow beyond a blogging tool…

Another one would be to have content hierarchies – something rarely seen in common blogging tools but nonetheless very useful to MANAGE content, not jsut ENTER it.

But I am digressing … oh, well, food for thought, or maybe for another post…

Last edited by marco (2004-06-10 23:02:53)

Offline

#4 2004-06-11 06:56:58

ReinierBiz
Archived Plugin Author
From: the Netherlands, Rotterdam
Registered: 2004-04-07
Posts: 42
Website

Re: Custom Fields: rei_show_custom

> misterk wrote:

> Great plugin, thanks Reinier.

> Is there a way that the plugin could be called from within another plugin?

No, I don’t think so, but you could ask the builder of your plugin to built in support for custom fields. It’s not that difficult to include.


VC88 | Nah, there weren’t really eighty-eight of them. They just called themselves “The Crazy 88.”

Offline

#5 2004-06-14 16:21:04

misterk
Member
From: Morris, MN
Registered: 2004-02-24
Posts: 77
Website

Re: Custom Fields: rei_show_custom

Ok, thanks.

Offline

#6 2004-06-17 07:14:20

Turbo-G
Member
From: Würzburg, Germany
Registered: 2004-04-15
Posts: 27
Website

Re: Custom Fields: rei_show_custom

Works great! Don

Offline

#7 2004-07-08 17:02:06

jdueck
Plugin Author
From: Minneapolis, MN
Registered: 2004-02-27
Posts: 147
Website

Re: Custom Fields: rei_show_custom

As written, this plugin has the same problem as if_article_list: it does not work unless placed after an article tag or in an article form. So if you wanted to use it in the <code>head</code> section of a page, for example (as I was using it to customize the meta keywords for articles), you need to change it a little.

Change the line at the top that sets the <code>$id</code> variable to look like this:

<pre><code>$id = gps(‘id’);</code></pre>

This works better, because it gets the id directly from the url without reling on the <code>doArticle</code> functions to set the global <code>thisarticle</code> first.

Thanks for a valuable plugin, by the way.

Offline

#8 2004-07-22 10:35:45

nils73
Member
From: Germany (Duesseldorf)
Registered: 2004-07-07
Posts: 15
Website

Re: Custom Fields: rei_show_custom

I would really like to use the plugin, but since I am using clean URLs it seems impossible to me to use it. The same problem applies to searches, where I only get the ID of the result.

Is there any way to rewrite the ID to a path with category? For example if I have

<pre><code>http://www.test.com/?id=8</code></pre>

is it then possible to rewrite it to a clean URL instead, such as

<pre><code>http://www.test.com/mysection/?c=mycategory</pre></code>

without having to hard-code an array?

Regards
Nils

Offline

#9 2004-07-27 14:53:04

nathanpitman
New Member
From: Berkshire, UK
Registered: 2004-04-05
Posts: 4
Website

Re: Custom Fields: rei_show_custom

> misterk wrote:
> Great plugin, thanks Reinier.
> Is there a way that the plugin could be called from within another plugin?

This would be very handy, I have tried to acheive something like this through a combination of PHP and TXP, but I guess the TXP and PHP parsing just aren’t playing together.

I’m trying to call an article from TXP using an article custom tag, but I want to populate the ‘category’ tag within this with the value of another articles custom field…

Hmm…

Offline

#10 2004-07-27 19:39:22

nils73
Member
From: Germany (Duesseldorf)
Registered: 2004-07-07
Posts: 15
Website

Re: Custom Fields: rei_show_custom

I have come up with a solution that is very very very static, but it works for my website and since it is an include, it is pretty easy to handle.

<pre><code>
<?php
$c = $GLOBALS[‘c’];
$id = $GLOBALS[‘id’];

$arr = array(

// ——————————————————————-
// SECTIONNAME 01
// ——————————————————————- ‘YourCategory01’ => array( ‘’=>17 // this means, that id is empty (‘’) ), ‘YourCategory02’ => array( 18=>18, // in case an id is there (18) 19=>19, 20=>20, 21=>21, 22=>22, 23=>23, 24=>24, 25=>25, 29=>29, 30=>30, 31=>31, 32=>32, 33=>33, 34=>34 ),
);
$id2 = $arr[$c][$id];

?>
</code></pre>

Now all you need to to is to alter the plugin-code and replace $id with $id2 and place an include in the second line of the plugin-code.

That might do the trick. But no guarantee for whatever.

Regards,
Nils

Offline

Board footer

Powered by FluxBB