Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2004-10-05 01:34:13
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
mdm_if_category + mdm_if_section + spc_section_alias
I’m outputting a section list using spc_section_alias, based on category & section conditions. Currently it’s not working and I’m receiving the text ‘Array’ output to the top of the page. I assume this is because one of the plugins is not parsing nested <code><txp: /></code> tags, but how to remedy this?
Last edited by compooter (2004-10-05 01:36:03)
Offline
Re: mdm_if_category + mdm_if_section + spc_section_alias
Once I overcame my typographical errors, I was successful in getting [txp:mdm_if_section section=”[txp:spc_section_alias_section /]”] to work. I have not tried checking for categories, so I cannot help you there.
(My bad… did not realize the angle brackets would cause the problem they did. How does one escape them on this board?)
Last edited by akb (2004-10-05 20:03:11)
Offline
#3 2004-10-05 14:48:50
- spchampion
- Archived Plugin Author
- Registered: 2004-06-10
- Posts: 62
Re: mdm_if_category + mdm_if_section + spc_section_alias
akb, something is wrong with your formatting. Can you edit your post and double check?
compooter, what does your form look like? Here’s the form I’m using for my archive page:
<pre>
<code>
<p>
<strong><txp:spc_section_alias_link /></strong><br />
<txp:spc_section_alias_description />
<br />
By Date: <txp:akw_month_list break=”, “ section=”<txp:spc_section_alias_section />” /><br />
By Category: <txp:asy_category_list break=”, “ section=”<txp:spc_section_alias_section />” />
</p>
</code>
</pre>
I then call spc_section_alias_iterate with the form I listed above. Note that I have modified asy_category_list to accept the section= value. I left a brief description in the asy_category_tag discussion about how I modified that particular plugin.
Offline
#4 2004-10-05 15:21:41
- spchampion
- Archived Plugin Author
- Registered: 2004-06-10
- Posts: 62
Re: mdm_if_category + mdm_if_section + spc_section_alias
Compooter, I think I know what what the problem is. Are you remembering to define the section alias information at the top of the page you’re loading (either in-line or out of a form)?
Offline
#5 2004-10-05 16:15:45
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
Re: mdm_if_category + mdm_if_section + spc_section_alias
Yes, I’ve got that all worked thru and the aliased sections is working great sitewide. It’s only when I try to wrap other tags nested a couple levels deep where it gets a bit nasty. Here’s my article form where I’m doing the magic. I’ll show you the version with inline PHP first, followed by the attempted multi-txp-tag version. (disclaimer: the txp tag version is written freehand so if there are typos please ignore)
php version (works correctly):
<pre>
<?php if ($GLOBALS[‘pretext’][‘s’] == ‘default’ && empty($_GET[‘c’]) ) { ?>
<h2>Browse by Section:</h2>
<div id=“section-list”>
<txp:spc_section_alias_iterate form=“section_list” wraptag=“ul” break=“li” group=“1” />
<txp:spc_section_alias_iterate form=“section_list” wraptag=“ul” break=“li” group=“2” />
</div>
<?php } else { ?>
<txp:if_article_list>
<txp:output_form form=“article_count_check” />
<txp:article form=“article_list” limit=“15” />
</txp:if_article_list>
<txp:if_individual_article>
<txp:article form=“article” />
</txp:if_individual_article>
<?php } ?>
</pre>
<div style=“height:1px;overflow:hidden;width:auto;background-color:#666;margin:5px auto;”></div>
mutli-plugin version (returns ‘Array’ before all page output):
<pre>
<txp:mdn_if_section section=“default”>
<txp:mdm_if_category category=”!”>
<h2>Browse by Section:</h2>
<div id=“section-list”>
<txp:spc_section_alias_iterate form=“section_list” wraptag=“ul” break=“li” group=“1” />
<txp:spc_section_alias_iterate form=“section_list” wraptag=“ul” break=“li” group=“2” />
</div>
</txp:mdm_if_category>
</txp:mdn_if_section>
<txp:mdn_if_section notsection=“default”>
<txp:mdm_if_category>
<txp:if_article_list>
<txp:output_form form=“article_count_check” />
<txp:article form=“article_list” limit=“15” />
</txp:if_article_list>
<txp:if_individual_article>
<txp:article form=“article” />
</txp:if_individual_article>
</txp:mdm_if_category>
</txp:mdn_if_section>
</pre>
Last edited by compooter (2004-10-05 16:43:39)
Offline
#6 2004-10-05 16:31:35
- spchampion
- Archived Plugin Author
- Registered: 2004-06-10
- Posts: 62
Re: mdm_if_category + mdm_if_section + spc_section_alias
So, just to make sure I understand, you’re saying that the PHP version works and the txp tag version does not?
If that’s the case, maybe there’s a problem with mdn_if_category. I have no idea what part of my plugin could be breaking this equation… That’s not to say that it isn’t, I just can’t see how.
Last edited by spchampion (2004-10-05 16:31:54)
Offline
#7 2004-10-05 16:44:32
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
Re: mdm_if_category + mdm_if_section + spc_section_alias
Yes, that’s correct. I’m wondering if perhaps one of those other two plugins is not properly parsing the enclosed content.
Offline
#8 2004-10-07 04:45:48
- spchampion
- Archived Plugin Author
- Registered: 2004-06-10
- Posts: 62
Re: mdm_if_category + mdm_if_section + spc_section_alias
One thing I see from looking at the plugin contents is that mdn_if_section does not parse the enclosed items before returning them. Just for fun, edit the mdn_if_section code and change the line that says “return ($enclosed);” to “return parse($enclosed);”.
Last edited by spchampion (2004-10-07 04:46:04)
Offline