Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2007-01-05 08:46:48

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: [plugin] [ORPHAN] chh_if_data

I am missing the functionality to have it return false, when only one condition returns false ( for multi-tag usage)

Is anyone else still interested in this ( to extend this plugin ) ?

regards, marios


⌃ ⇧ < ⌃ ⇧ >

Offline

#26 2007-01-17 20:40:58

dada78
Member
From: New York
Registered: 2005-10-27
Posts: 138
Website

Re: [plugin] [ORPHAN] chh_if_data

takshaka wrote:

This tag may be used to determine whether some contained Txp tags output any data, allowing the conditional output of accompanying static markup, like a header or a “no articles found” message.

—> I can’t get the plug-in to return “No articles found” and have the following code in my search_results form:

<code><txp:chh_if_data>
<p>Here’s an article list containing your search inquiry</p>
<p><txp:search_result_title /></p>
<txp:else />
<p>No articles found</p>
</txp:chh_if_data></code>

All I get are the search results. Which at least is a beginning. ;-)

Any advice?

Thanks!
Dada

Last edited by dada78 (2007-01-17 20:41:24)

Offline

#27 2007-01-17 23:26:27

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

Re: [plugin] [ORPHAN] chh_if_data

Try this:

On the page:

<txp:if_search>
<txp:chh_if_data>
<p>Here’s an article list containing your search inquiry</p>
<txp:article />
<txp:else />
<p>No articles found</p>
</txp:chh_if_data>
</txp:if_search>

In form search_results:

<p><txp:search_result_title /></p>

Offline

#28 2007-07-29 11:20:24

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

Re: [plugin] [ORPHAN] chh_if_data

Why doesn’t this work in form: ‘search_results’?

<txp:chh_if_data>
<div class="search">
<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>
</div>
</txp:chh_if_data>

Last edited by RedFox (2007-07-29 11:21:47)

Offline

#29 2007-07-29 13:48:05

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

Re: [plugin] [ORPHAN] chh_if_data

RedFox wrote:

Why doesn’t this work in form: ‘search_results’?

Because as far as I know you can only use one txp tag inside chh_if_data (otherwise it won’t know which tag to check for data).

Offline

#30 2007-07-29 17:32:28

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: [plugin] [ORPHAN] chh_if_data

For the conditional display of content depending on the result of a search try rss_if_search_results.

Offline

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

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 809
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
Moderator
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: 809
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
Archived 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,373

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

Board footer

Powered by FluxBB