Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-05-30 01:34:54

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

error_default page and if_section

What can I do so that the page error_default isn’t included by <txp:if_section name=",">?

Offline

#2 2011-05-30 06:49:40

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,001
Website GitHub

Re: error_default page and if_section

maybe txp:if_status helps (in the error handling tags section of the docs)


TXP Builders – finely-crafted code, design and txp

Offline

#3 2011-05-30 13:27:39

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: error_default page and if_section

Thanks jacob for your reply. However, that does not help with my problem. I have to explain it better:

In the nav I use <txp:it_section name=","> for an output of a class=“active” and other effects if the default page (Home) is shown. But, with an error message about the error_default page, the home link in the nav also receives the class=“active”.

In the error_default page I use @<txp:if_status> in this way (but can’t see what this has to do with the problem):

<txp:if_status status="404"><p>Text.</p><txp:else />
<p>Other text.</p></txp:if_status>

Last edited by GugUser (2011-05-30 13:29:24)

Offline

#4 2011-05-30 14:01:15

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,001
Website GitHub

Re: error_default page and if_section

would not the following do what you want:

<li<txp:if_status status="404"><txp:else /><txp:if_section name=","> class="active"</txp:if_section></txp:if_status>><a href="<txp:site_url />">Home</a></li>

TXP Builders – finely-crafted code, design and txp

Offline

#5 2011-05-30 14:42:16

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: error_default page and if_section

Thanks jakob.

The complete first <li>@ element in the nav was:

<li class="index<txp:if_section name=","> aktiv"><span>Name <em>Subname</em></span><txp:else />"><a href="/" accesskey="0"><span>Name <em>Subname</em></span></a></txp:if_section></li>

And now I have extended it (it works):

<txp:if_status><li class="index<txp:if_section name=","> aktiv"><span>Name <em>Subname</em></span><txp:else />"><a href="/" accesskey="0"><span>Name <em>Subname</em></span></a></txp:if_section></li><txp:else /><li class="index"><a href="/" accesskey="0"><span>Name <em>Subname</em></span></a></li></txp:if_status>

But, I mean, this is unnecessarily complicated. I would be interested in the answer to the question: What can I do so that the error_default page isn’t recognized as default page? Or, how I define a another error page? Is the only way to do this on the .htaccess file?

Offline

#6 2011-05-31 02:55:55

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: error_default page and if_section

GugUser wrote:

but can’t see what this has to do with the problem

What can I do so that the error_default page isn’t recognized as default page?

Error pages use same section as the default (front) page. That’s how life is. Otherwise all section specific links on error pages would point to a (non-existing) different section than the front page.

If you want to minify the code, and only use one conditional, you can use variables, for example.

<!--
	Set variable named "home" to "true" if the HTTP status code is 200
	and we are on the default section. Empty otherwise.
-->

<txp:variables name="home" value='<txp:if_status><txp:if_section name="">true</txp:if_section></txp:if_status>' />

<!--
	Example usage of the conditional.
-->

<txp:if_variable name="home" value="true">
	Default page.
<txp:else />
	Elsewhere.
</txp:if_variable>

Last edited by Gocom (2011-05-31 02:58:47)

Offline

Board footer

Powered by FluxBB