Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2007-07-29 19:30:21

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 740
Website

Re: [plugin] [ORPHAN] chh_if_data

That doesn’t work either!

<div class="search">
<txp:rss_if_search_results>
<h4><txp:permlink><txp:title /></txp:permlink></h4>
<p><txp:search_result_excerpt /></p>
<txp:else />
<h4>Oops ... no results!</h4>
<p>Try another search ... :)</p>
</txp:rss_if_search_results>
</div>

Offline

#32 2007-07-29 20:00:10

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

Re: [plugin] [ORPHAN] chh_if_data

Joop, this will achieve the same and it will work :)

On the page:

<txp:if_search>
<div class="search">
<txp:chh_if_data> (or <txp:rss_if_search_results>)
<txp:article form="search_results" />
<txp:else />
<h4>Oops ... no results!</h4>
<p>Try another search ... :)</p>
</txp:chh_if_data> (or </txp:rss_if_search_results>)
</div>
</txp:if_search>

Form ‘search_results’:

<h4><txp:permlink><txp:title /></txp:permlink></h4>
<p><txp:search_result_excerpt /></p>

Offline

#33 2007-07-31 12:09:10

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 740
Website

Re: [plugin] [ORPHAN] chh_if_data

Els, <txp:chh_if_data> is working. With <txp:rss_if_search_results> TXP is asking for an article tag … !? Thanks for help.

Offline

#34 2007-10-22 10:12:59

Minde
New Member
Registered: 2007-10-22
Posts: 1

Re: [plugin] [ORPHAN] chh_if_data

Brilliant plugin. Just what I’ve been looking for. Thanks!

Offline

#35 2007-12-27 21:05:54

obeewan
Plugin Author
From: Stockholm, Sweden
Registered: 2004-08-12
Posts: 319
Website

Re: [plugin] [ORPHAN] chh_if_data

This plugin is one I wish I’d thought of. Brilliant, just brilliant. Two thumbs up and some toes aswell since it has saved me from alot of workarounds and hacks doing some TXP magic.

The multiple tag feature as mentioned earlier would make it sweeter. But it’s sweet allready.


Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1

“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu

Offline

#36 2008-06-27 05:46:06

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,225
Website

Re: [plugin] [ORPHAN] chh_if_data

This plugin was exactly what I was looking for except it was failing because blank lines were being counted as “data”. I don’t know why blank lines are appearing, but in this particular situation they are simply whitespace on the web page.

I tweaked the chh_if_data code as follows:

Line 2, changed to:

$atts = lAtts(array('debug' => 0,'ignore' => 0), $atts);

Insert line:

if ($atts['ignore']) $parsed = trim($parsed);

before:

$parsed_len = strlen($parsed);

Now I can call chh_if_data with an extra attribute:

<txp:chh_if_data ignore="1">
<txp:article_custom ...... />
<txp:else />
<p>Nothing today</p>
</txp:chh_if_data>

Extraneous whitespace is now ignored and the “Nothing today” message is displayed when there’re no articles.

Offline

#37 2008-10-17 15:25:40

maxvoltar
Member
From: Machelen, Belgium
Registered: 2007-08-16
Posts: 76
Website

Re: [plugin] [ORPHAN] chh_if_data

Nevermind, I’m such an idiot… Great work!

Last edited by maxvoltar (2008-10-17 15:32:38)


Textpattern projects: Maxvoltar, Made by Elephant, Twunch

Offline

#38 2009-02-09 17:08:18

nabrown78
Member
From: Boston, MA, USA
Registered: 2006-10-04
Posts: 289
Website

Re: [plugin] [ORPHAN] chh_if_data

Similar to some earlier comments in this thread, I’d love to be able to use this around multiple txp tags, and specify which one to check for data. In my case, I only want to check the <txp:article /> tags. The plugin code looks so short and simple, but I don’t know where to begin to achieve something like that…can anyone help? Or is there another plugin that might serve this function?

Edit: Okay, simple except for this:

$f = '/<txp:(\S+)\b(.*)(?:(?<!br )(\/))?'.chr(62).'(?(3)|(.+)<\/txp:\1>)/sU';

Any experts care to break that down?

Last edited by nabrown78 (2009-02-09 17:12:10)

Offline

#39 2009-02-09 19:34:35

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

Re: [plugin] [ORPHAN] chh_if_data

Have you tried to achieve what you want with the variable and if_variable tags?

Offline

#40 2009-02-14 15:41:01

nabrown78
Member
From: Boston, MA, USA
Registered: 2006-10-04
Posts: 289
Website

Re: [plugin] [ORPHAN] chh_if_data

Hmm…okay, I see that maybe I could output some piece of the article into a <txp:variable />, and then check for data in that variable…is that what you’re thinking? I’ll try it out.

Offline

Board footer

Powered by FluxBB