Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-10-22 16:38:41

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

How to close a container tag in PHP?

Hi folks!
For a very special use I’m have to place this kind of code in my form :
<code>
<txp:php>

$num = file_download_id(array()); // file id in locale $num variable

echo file_download_link(
array(
‘id’ => $num,
));
</txp:php>Download<txp:php>echo file_download_link(array());</txp:php>
</code>

As you can see the last ligne is wrong : I want to close the Container Tag “txp:file_download_link” but I’ve any idea how to proceed.

Could you help me?
Thanks a lot for your answer.
Cheers,
Patrick.


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#2 2006-10-22 16:48:17

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: How to close a container tag in PHP?

For container tags, the second parameter in the function call is the string with the ‘contained code’.
Perhaps this is what you’re looking for (and I’m curious… what special use does this have?):

<txp:php>
  echo file_download_link(
    array( ‘id’ => file_download_id(''),
    'Download'
  );
</txp:php>

Last edited by ruud (2006-10-22 19:22:39)

Offline

#3 2006-10-22 17:15:50

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Re: How to close a container tag in PHP?

Hi ruud! How are u?
I’m traing your code… and it doesn’t work!
I do not understand that the attribute “id” can be affected with the tag itself.
It seems to me that there is an attribute $thing for this use, but I’m not sure.

ruud wrote:

(and I’m curious… what special use does this have?):

:)) The ‘very very special use’ is because Mary’s upm_file_packets plugin don’t work fine with…<strong>TXP four ho four</strong>, and I’m looking for an another way for my purpose ;)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#4 2006-10-22 19:25:21

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: How to close a container tag in PHP?

Are you using this in the context of the file_download_list tag? Otherwise file_download_id may not be defined.

Offline

#5 2006-10-23 02:40:25

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: How to close a container tag in PHP?

That’s not how those tags work, and I’m not sure what you’re trying to achieve.

Offline

#6 2006-10-23 17:38:58

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Re: How to close a container tag in PHP?

Ok. I withdraw the example given above.
My new question is this one: how to close a container tag using PHP code?
For example with the tag <txp:if_article_list>.

The single tags do not pose a problem; it seems to me that this question could interest much of people here.
Thanks lot again.


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#7 2006-10-23 18:06:20

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: How to close a container tag in PHP?

Generic example:

<txp:container_tag attr1="value1" attr2="value2">foobar</txp:container_tag>
<txp:php>echo container_tag(array('attr1' => 'value1', 'attr2' => 'value1'), 'foobar')</txp:php>

Last edited by ruud (2006-10-23 18:07:38)

Offline

#8 2006-10-23 19:09:20

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Re: How to close a container tag in PHP?

THANKS ruud!
What a beautiful demonstration.
Thanks lot : it’s a great help for everyone.

P.S.
Afflicted not to have answered about my precedent images question. In fact my problem was badly posed: I wished to protect my /file directory from the Web copiers and I solved that with some .htaccess and .htpass.


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

Board footer

Powered by FluxBB