Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-07-14 14:18:20

sekhu
Member
Registered: 2005-05-12
Posts: 428
Website

Question about Custom Fields and Comments

Hi,

1) I’m trying to display a custom field on my site which is easy enough. What i’d like to do is use an image to display as well the text for that custom field.

So, for example.

Custom Field: Name

displays <nameofuser><userrelatedimage>

The code I’m looking at is this:

<code><img src=”../images/<txp:custom_field name=“WrittenBy” />.gif” alt=“writtenby” /></code> Would that work and display both the name and the image?

2) I’ve written over 350 articles and now I want to enable comments site wide. If I enable comments will it enable them site wide for all the articles, or only from the current article onwards? What I want to achieve is comments for all articles to be available.

Thanks in advance

<small>(edited to display everything. -Els)</small>

Last edited by els (2006-07-14 14:45:43)

Offline

#2 2006-07-14 15:03:55

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Question about Custom Fields and Comments

1) Yep, that’s the way to go. If the content of your custom field ‘Writtenby’ is Sekhu, and you have an image Sekhu.gif, and you want the output to be
<code>
Sekhu <img src=”../images/Sekhu.gif” alt=“Sekhu” />
</code>
use this code:
<code>
<txp:custom_field name=“Writtenby” /> <img src=”../images/<txp:custom_field name=“Writtenby” />.gif” alt=”<txp:custom_field name=“Writtenby” />” />
</code>
2) Enable comments in preferences will only enable comments site wide from now on. The easiest way to enable comments for all existing articles is running a query in phpMyAdmin on the ‘textpattern’ table, to set the field ‘annotate’ to ‘1’ for all records. I hope someone else can tell you what this query should be…

Last edited by els (2006-07-14 15:05:11)

Offline

#3 2006-07-15 07:13:41

sekhu
Member
Registered: 2005-05-12
Posts: 428
Website

Re: Question about Custom Fields and Comments

thanks els, i tried the code but for some reason it didn’t work, uploaded the image with it but no joy. o might just dump it if it’s going to get complex i think.

Can anyone shed any light on the mass wide comments?

Offline

#4 2006-07-15 11:15:20

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Question about Custom Fields and Comments

sekhu wrote:

thanks els, i tried the code but for some reason it didn’t work, uploaded the image with it but no joy.

Are you sure the image path is right? You could try “/images/etc.” or “images/etc.”.

Offline

Board footer

Powered by FluxBB