Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2009-11-01 02:19:19

speeke
Member
From: Bruny Island, Australia
Registered: 2009-03-29
Posts: 161
Website

Re: Search problem with static page

Yes, it is part of sed_section_fields v0.5.3 which provides admin interface field customisation on a per-section basis.

If I understand correctly, the “Treat as a static section?“ (“Yes”) means that you can’t save a new article in a “static” section – ie only one article is allowed – great for “About”, “Contact” pages etc. Also, its corresponding section is only visible, in the Section dropdown in the Write tab, if your user permissions are that of Publisher.

I believe this version was modified by Gerhard who wrote glz_custom_fields v1.2.3 (which I also have installed).

I tried changing the option to “No”, and also tried disabling sed_section_fields, but I am still having the same problem. So I doubt this is the issue.

Grateful for any other suggestions :)

Last edited by speeke (2009-11-01 04:37:45)


“People who value their privileges above their principles soon lose both.”
Dwight D. Eisenhower

Offline

#14 2009-11-01 05:14:25

speeke
Member
From: Bruny Island, Australia
Registered: 2009-03-29
Posts: 161
Website

Re: Search problem with static page

Problem appears to be solved!

It seems that the <txp:if_category> tag in page “default” was the cause of the problem. I am not using categories for the About article.

I tried adding default categories to Category 1 and Category 2 in the About article “Sort and Display” to see if that worked, but it didn’t. So I had to delete the category tag in page “default”. Not sure why. Does that make sense?

Anyway, my final question in this thread is:

How can I output the search result url so that it reads:

http://domain.com/about/

rather than:

http://domain.com/about/about

Thanks in advance.


“People who value their privileges above their principles soon lose both.”
Dwight D. Eisenhower

Offline

#15 2009-11-01 06:10:15

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: Search problem with static page

Some possible solutions, off the top of my head:

A) If this is the only case you need to fix, you can resort to some ad-hoc/specific code, like:

On your article form (adapt the code to your desired output)

<txp:if_article_id id="XX"> <!-- XX is the id of your "about" article -->
  <a href="/about/"><txp:title /></a>
<txp:else />
<!-- for any other article -->
  <txp:permlink><txp:title /></txp:permlink>
</txp:if_article_id>

B) For a more generic solution (code yet to be tested), you could try this:

On your article form:

<txp:variable name="article_url_title" value='<txp:article_url_title />' /> <!-- we save the article URL title of current search result inside a variable -->
<txp:if_variable name="article_url_title" value='<txp:section />'> <!-- we compare the variable value against the section to which the current search result belongs, and if it's true, then: -->
  <txp:section><txp:title /></txp:section>
<txp:else /> <!-- not true, that is, article_url_title isn't equal to the section the article belongs to-->
  <txp:permlink><txp:title /></txp:permlink>
</txp:if_variable>

Of course, this will depend on keeping a convention: articles that are used as “static pages” must have their url_title matching the name of the section.

A shorter variation, using smd_if plugin (a must have) and without the need of creating a variable:

<txp:smd_if field='<txp:article_url_title />' operator="eq" value='<txp:section />'>
  <txp:section><txp:title /></txp:section>
<txp:else />
  <txp:permlink><txp:title /></txp:permlink>
</txp:smd_if>

BTW, notice that when nesting txp tags inside txp tags, you have to use single quotes.

Let us know if any of the above worked as expected.

Last edited by maniqui (2009-11-01 06:13:53)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#16 2009-11-01 06:49:46

speeke
Member
From: Bruny Island, Australia
Registered: 2009-03-29
Posts: 161
Website

Re: Search problem with static page

Many thanks maniqui.

Works like a charm!

This is the content of my search_results form:

<h3 class="entry-title"><txp:smd_if field='<txp:article_url_title />' operator="eq" value='<txp:section />'>
  <txp:section><txp:title /></txp:section>
<txp:else />
  <txp:permlink><txp:title /></txp:permlink>
</txp:smd_if>
</h3>
<p class="published"><txp:posted /></p>
<p class="entry-summary"><txp:search_result_excerpt /></p>
<p class="small"><txp:smd_if field='<txp:article_url_title />' operator="eq" value='<txp:section />'>
  <txp:section><txp:site_url /><txp:section />/</txp:section>
<txp:else />
  <txp:permlink><txp:permlink /></txp:permlink>
</txp:smd_if></p>
<div class="divider"><img src="<txp:site_url />images/1.gif" width="400" height="1" alt="---" title="" /></div>

Much appreciated :)

Last edited by speeke (2009-11-01 07:03:36)


“People who value their privileges above their principles soon lose both.”
Dwight D. Eisenhower

Offline

Board footer

Powered by FluxBB