Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-08-10 07:11:23

brighthearted
New Member
Registered: 2005-11-21
Posts: 8

Passing variables through "txp:output_form"

Hello everyone,

My question focuses on the “txp:output_form /” tag. Below is a crackpot idea I’ve boiled up. I realize none of the methods I’ve listed would work. I’m fully aware of this. What I’m doing is asking if there’s another way of doing something very similar that I’m not yet aware of. My idea stems from the spirit of duplicating as little code as possible.

Let’s say I wanted to create a form/include with the HTML code from the BODY tag and up. Is there a way to create “hooks” or variables in this form/include so that when I call it in using “txp:output_form /”, I could define these hooks/variables? So on my page titled “Blammy” I would call in this form with the following code…

<txp:output_form custommeta="blammy services" custombody="blammy" />

And then the code for this form/include would look like this…

DOCTYPE STUFF
<head>
<meta name="keywords" content="{custommeta}" />
<title>Title goes here</title>
</head>

<body class="{custombody}">

Does something with similar functionality exist? Does what I’m trying to do even make sense?

{Edited to convert ancient forum code to Textile. – Uli}

Last edited by uli (2012-06-03 14:32:49)

Offline

#2 2006-08-10 08:00:10

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: Passing variables through "txp:output_form"

If you’re just outputting a specific form based on a section:

In your page template:

<txp:if_section name="services">
	<txp:output_form form="_header-services" />
<txp:else />
	<txp:output_form form="_header-regular" />
</txp:if_section>

OR if based on whether it’s a single article or list:

<txp:if_article_list>
	<txp:output_form form="_header-list" />
<txp:else />
	<txp:output_form form="_header-single" />
</txp:if_article_list>
</pre>

OR if it’s based on a custom value, which is what I think you’re getting at:

<txp:if_custom_field name="foo" value="bar">
	<txp:output_form form="_header-special" />
<txp:else />
	<txp:output_form form="_header-regular" />
</txp:if_custom_field>

{Edited to convert ancient forum code to Textile. – Uli}

Last edited by uli (2012-06-03 14:33:29)

Offline

Board footer

Powered by FluxBB