Textpattern Forum

You are not logged in. Register | Login | Help

#71 2008-07-07 19:27:11

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 752
Website

Re: Central storage for site-wide constants: Helpful?

maniqui

Your version looks much more simple. I was just drawing a mental block on how it set the class for the comment tag. But I’ll play with it and I’m sure the light will go on! :-)

Mike

Last edited by maverick (2008-07-07 19:29:15)

Offline

#72 2008-07-07 20:27:59

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 752
Website

Re: Central storage for site-wide constants: Helpful?

Hmm. My way may have looked nicer and relevant to the forum, but doesn’t do the job. Besides several changes in order for make it work, right now it indiscriminately applies the author class to all comments when the author is logged in, or conversely, the non-author class to every comment. Somehow I need to compare the comment author to the article author and then pass the class when that condition is met.

<big smile>
We don’t have a <txp:if_comment_author=article_author> conditional tag yet, do we ;-P

Or maybe a <txp:if_variable name=“comment_author” /> = <txp:variable name=“article_author” />

</big smile>.

edit

maniqui – I see you already noted the need for <=> operations. Sorry I missed your post. Didn’t mean to repeat needlessly.

Last edited by maverick (2008-07-07 20:33:12)

Offline

#73 2008-07-07 20:33:10

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 2,989
Website

Re: Central storage for site-wide constants: Helpful?

Of course… my (and yours) examples don’t make ANY sense at all…
I’m ashamed of it… it looks “clever” at first, but now, my code looks stupid…

Let’s keep thinking…


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#74 2008-07-07 20:50:31

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 3,061

Re: Central storage for site-wide constants: Helpful?

I’m not experienced with applying comments, it’s just that I see that the comments tag is something like the article tag, i.e. it can call forms. The class needs to be given in that form (i.e. individually), but not to all articles/comments, I think. Does that make sense?

Edited for textiling

Last edited by uli (2008-07-07 20:51:25)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#75 2008-07-07 21:15:17

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,868
Website

Re: Central storage for site-wide constants: Helpful?

maverick wrote:

Or maybe a <txp:if_variable name=“comment_author” /> = <txp:variable name=“article_author” />

:-) Closer than you think… umm, I think. Off the top of my head, in your comment form as uli sugggests:

<txp:variable name="this_comment" value='<txp:comment_name />' />
<txp:if_variable name="this_comment" value='<txp:author />'>
 // Apply the author style
</txp:if_variable>

Untested, and probably utter carp, but perhaps worth experimenting with.

EDIT: and of course it depends if <txp:author / returns the “real name” or the “user name”. Can’t remember.

Last edited by Bloke (2008-07-07 21:21:44)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Online

#76 2008-07-07 21:29:02

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 3,061

Re: Central storage for site-wide constants: Helpful?

To a certain degree OT, but we’re talking about comments at the moment: I needed to use Textbook for my last post and saw that <txp:comments /> isn’t mentioned on the page with page/column related tags. Where is the right place to ask for adding it there?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#77 2008-07-07 21:49:58

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,388
Website

Re: Central storage for site-wide constants: Helpful?

uli wrote:

<txp:comments /> isn’t mentioned on the page with page/column related tags.

Well, it shouldn’t be there, the tag belongs in an article form :)


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#78 2008-07-07 21:55:19

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 3,061

Re: Central storage for site-wide constants: Helpful?

Sometimes it’s rather good when the counter is closed or hidden ;))


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#79 2008-07-07 21:59:16

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 752
Website

Re: Central storage for site-wide constants: Helpful?

Bloke wrote:

Untested, and probably utter carp, but perhaps worth experimenting with.

Will try it out when I get a chance. Have to take off for a bit.

EDIT: and of course it depends if <txp:author / returns the “real name” or the “user name”. Can’t remember.

It returns the “real name”.

At this point its more an exercise in understanding txp:variable and nested tags, and proof of concept. I suspect that in the end it might be more simple to use a one of the excellent plugins out there ;)

Offline

#80 2008-07-07 22:00:35

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 2,989
Website

Re: Central storage for site-wide constants: Helpful?

Bloke wrote:

<txp:variable name="this_comment" value='<txp:comment_name />' />
<txp:if_variable name="this_comment" value='<txp:author />'>
 // Apply the author style
</txp:if_variable>

EDIT: and of course it depends if <txp:author / returns the “real name” or the “user name”. Can’t remember.

Probably less prone to errors could be to compare the commenter email against the author e-mail, which can’t be currently retrieved by txp tags, so it could be compared to a custom field that has author’s e-mail.

<txp:variable name="this_comment" value='<txp:comment_email />' />
<txp:if_variable name="this_comment" value='<txp:custom_field name="author_email" />'>
 // Apply the author style
</txp:if_variable>

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB