Textpattern CMS support forum

You are not logged in. Register | Login | Help

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

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…

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

<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)


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

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

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" />

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

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

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" />

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

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


Board footer

Powered by FluxBB

Follow @txpforum on Twitter