Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2010-06-02 17:59:07

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

Re: Outputing a list of articles for specific category on landing page

The form beneath is called with this <txp:article_custom section="assortiment" category="assortiment" form="-landing-subcat" />

And outputs this:-

<txp:if_custom_field name="Subcategorie">
	<txp:category name='<txp:custom_field name="Subcategorie"  />' title="1" link="1" />
</txp:if_custom_field>

Unfortunately There are two problems:
1. The form outputs nothing on landing page. (when i use another form with the content underneath it works, but of course wrong uri destination).
2. Secondly <txp:category ... link="1" /> outputs only a link and doesn’t allow me to dictate what aspects of the article are rendered i.e. <txp:image /> etc. etc. I don’t want just the title or a custom_field I need access to everything the article contains.

This is an example of the type of article output i require:

<li class="sub-category <txp:custom_field name='Subcategorie' />" id="<txp:article_id />">
    <h2>
	<a href="<txp:permlink />"> <!-- Should actually be a linktochildcat and not to individual article -->
	<span class="entry-title">
	    <span class="type"><txp:custom_field name="Hoofdcategorie" />&#160
		<if_txp:custom_field name="Subcategorie">
		    <txp:custom_field name="Subcategorie" />
		</if_txp:custom_field>
	    </span>
	</span>
	<span class="entry-image">
	    <txp:article_image />
	</span>
	</a>
    </h2>
</li>

Last edited by Timid&friendly (2010-06-02 18:04:52)


I think, therefore I AM, … … er … I think :-?

Offline

#14 2010-06-02 18:16:22

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

Re: Outputing a list of articles for specific category on landing page

Re #2: replace <a href="<txp:permlink />"> with this:

<a href="<txp:site_url /><txp:section />/?c=<txp:custom_field name="Subcategorie" />">

Re #1: It outputs nothing on the landing page, but it does on the category pages? Can you post a tag trace of the landing page?

BTW, if_txp:custom_field should be txp:if_custom_field, but I guess you know that ;)

Offline

#15 2010-06-03 04:50:24

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

Re: Outputing a list of articles for specific category on landing page

Thx Els

<!-- txp tag trace: 
[SQL (0.00417184829712): select name, data from txp_lang where lang='en-gb' AND ( event='public' OR event='common')]
[SQL (0.00145792961121): select name, code, version from txp_plugin where status = 1 AND type IN (0,1) order by load_order]
[SQL (0.000200986862183): select name,code,version from txp_plugin where status = 1 AND name='soo_txp_obj']
[SQL (9.67979431152E-5): select name,code,version from txp_plugin where status = 1 AND name='soo_plugin_pref']
[SQL (0.000329971313477): select name, val, html, position from txp_prefs where name like 'soo_multidoc.%' order by position asc]
[SQL (0.000265836715698): 
    SELECT
      `name` AS custom_set,
      `val` AS name,
      `position`,
      `html` AS type
    FROM
      `txp_prefs`
    WHERE
      `event`='custom'
    ORDER BY
      `position`
  ]
[SQL (0.000248908996582): 
      SELECT
        `name`, `val`
      FROM
        `txp_prefs`
      WHERE
        `html` = 'date-picker'
      AND
        `name` LIKE 'custom_%'
      ORDER BY
        `name`
    ]
[SQL (0.000255823135376): 
      SELECT
        `name`, `val`
      FROM
        `txp_prefs`
      WHERE
        `html` = 'time-picker'
      AND
        `name` LIKE 'custom_%'
      ORDER BY
        `name`
    ]
[SQL (0.00023889541626): select name from txp_section where `name` like 'assortiment' limit 1]
[SQL (0.000146150588989): select page, css from txp_section where name = 'assortiment' limit 1]
[SQL (0.000386953353882): select `ID` from textpattern where `Status` > '3' and (now() <= Expires or Expires = '0000-00-00 00:00:00') and Posted <= now()]
[SQL (0.000240087509155): select `ID`,`custom_5` from textpattern where `custom_5` regexp '[[:digit:]]']
[SQL (0.000310182571411): select host from txp_log where ip='234.678.123.345' limit 1]
[SQL (0.000228881835938): insert into txp_log set `time`=now(),page='/site/txp/assortiment/',ip='234.678.123.345',host='234.678.123.345.ip.telfort.nl',refer='',status='200',method='GET']
[SQL (0.000208854675293): select user_html from txp_page where name='landingpage new backup']
[Page: landingpage new backup]
<txp:output_form form="-head" />
	[SQL (0.000211954116821): select Form from txp_form where name='-head']
	[Form: -head]
	<txp:site_url />
	<txp:site_url />
	<txp:site_url />
	<txp:site_url />
	<txp:site_url />
<txp:if_section name="">
	[<txp:if_section name="">: false]
	<txp:section />
</txp:if_section>
<txp:if_individual_article>
	[<txp:if_individual_article>: false]
</txp:if_individual_article>
<txp:output_form form="-accessibility" />
	[SQL (0.000119209289551): select Form from txp_form where name='-accessibility']
	[Form: -accessibility]
<txp:output_form form="-branding-nav" />
	[SQL (0.000125169754028): select Form from txp_form where name='-branding-nav']
	[Form: -branding-nav]
	<txp:link_to_home>
		<txp:site_url />
	</txp:link_to_home>
	<txp:site_slogan />
	<txp:section_list active_class="current" sections="default" default_title="Voorpagina" sections="default" />
		[SQL (0.00012993812561): select name, title from txp_section where name in ('default') order by field(name, 'default')]
	<txp:section_list active_class="current" sections="over-penpoint" />
		[SQL (0.000125885009766): select name, title from txp_section where name in ('over-penpoint') order by field(name, 'over-penpoint')]
	<txp:if_section name="over-penpoint">
		[<txp:if_section name="over-penpoint">: false]
	</txp:if_section>
	<txp:if_section name="assortiment">
		[<txp:if_section name="assortiment">: true]
	</txp:if_section>
	<txp:section_list active_class="current" sections="assortiment" />
		[SQL (0.000126838684082): select name, title from txp_section where name in ('assortiment') order by field(name, 'assortiment')]
	<txp:if_section name="assortiment">
		[<txp:if_section name="assortiment">: true]
		<txp:category_list active_class="current" section="assortiment" categories="export-landingpage" break="li" />
			[SQL (0.000241994857788): select name, title from txp_category where type = 'article' and name in ('export-landingpage') order by field(name, 'export-landingpage')]
		<txp:category_list active_class="current" section="assortiment" categories="penpoint-partner,unique" break="li" />
			[SQL (0.000165939331055): select name, title from txp_category where type = 'article' and name in ('penpoint-partner','unique') order by field(name, 'penpoint-partner','unique')]
	</txp:if_section>
	<txp:section_list active_class="current" sections="aanbiedingen" />
		[SQL (0.000136137008667): select name, title from txp_section where name in ('aanbiedingen') order by field(name, 'aanbiedingen')]
	<txp:if_section name="aanbiedingen">
		[<txp:if_section name="aanbiedingen">: false]
	</txp:if_section>
	<txp:section_list active_class="current" sections="contact" />
		[SQL (0.000128984451294): select name, title from txp_section where name in ('contact') order by field(name, 'contact')]
	<txp:if_section name="contact">
		[<txp:if_section name="contact">: false]
	</txp:if_section>
<txp:if_individual_article>
	[<txp:if_individual_article>: false]
	<txp:if_category>
		[<txp:if_category>: false]
		<txp:article_custom section="assortiment" category="assortiment" form="-landing-subcat" />
			[SQL (0.000577211380005): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('assortiment') or Category2 IN ('assortiment')) and Section IN ('assortiment') order by Posted desc limit 0, 10]
			[article 58]
			[SQL (0.000120878219604): select Form from txp_form where name='-landing-subcat']
			[Form: -landing-subcat]
			<txp:if_custom_field name="Subcategorie">
				[<txp:if_custom_field name="Subcategorie">: false]
			</txp:if_custom_field>
			[article 57]
			[Form: -landing-subcat]
			<txp:if_custom_field name="Subcategorie">
				[<txp:if_custom_field name="Subcategorie">: false]
			</txp:if_custom_field>
			[article 56]
			[Form: -landing-subcat]
			<txp:if_custom_field name="Subcategorie">
				[<txp:if_custom_field name="Subcategorie">: false]
			</txp:if_custom_field>
	</txp:if_category>
</txp:if_individual_article>
<txp:output_form form="-footer" />
	[SQL (0.000119209289551): select Form from txp_form where name='-footer']
	[Form: -footer]
[ ~~~ secondpass ~~~ ]
 -->

Last edited by Timid&friendly (2010-06-03 04:52:46)


I think, therefore I AM, … … er … I think :-?

Offline

#16 2010-06-03 22:13:55

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

Re: Outputing a list of articles for specific category on landing page

What the tag trace seems to say is that your articles 56, 57 and 58 don’t have a value in custom field ‘Subcategorie’. If you are sure you entered a value, is the name of the custom field spelled correctly? Does it output anything if you just put <txp:custom_field name="Subcategorie" /> in your form -landing-subcat?

Edit: I noticed your post in the glz_custom_fields thread. If this is about the same site, and my above suggestions don’t help, did you check if the plugin could be interfering?

Last edited by els (2010-06-03 22:21:10)

Offline

#17 2010-06-04 05:22:16

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

Re: Outputing a list of articles for specific category on landing page

Thx for your pointers! It’s now working. For the sake of reference here is the sectionpage code:-

<txp:if_individual_article>
	<h1>single article needs own form</h1>
	<txp:article />
	<txp:else />
	<txp:if_category>
		<txp:if_category name="export-landingpage">
			<h1>Export-landingpage</h1>
			 <ul class="category" <txp:category />>
				<txp:article form="-landingpg-cat-export" />
			</ul>
		<txp:else />
			<h1><txp:category title="1" />: This is a child category page</h1>
			<ul class="category" <txp:category />>
			    <txp:article form="-landingpg-cat-child" />
			</ul>
		</txp:if_category>
		<txp:else />
			<h1>Assortiment - This is the section landing page</h1>
			<ul class="main-categories">
			    <txp:article_custom section="assortiment" category="assortiment" sort="title" form="-landingpg-cat" />
			</ul>
	</txp:if_category>
</txp:if_individual_article>

I wouldn’t have got here without your pointers Els, many many thx.

Last edited by Timid&friendly (2010-06-04 05:26:33)


I think, therefore I AM, … … er … I think :-?

Offline

#18 2010-06-04 08:00:06

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

Re: Outputing a list of articles for specific category on landing page

Glad you got it to work :)

Offline

Board footer

Powered by FluxBB