Re: A function like 'Fetch' but only grabs info inside a certain tag.
| From: | Monte Ohrt | Date: | Tue, 26 Feb 2002 14:32:35 +0000 |
| Subject: | Re: A function like 'Fetch' but only grabs info inside a certain tag. | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2849@lists.php.net to get a copy of this message | ||
Just curious, what are you trying to accomplish? Why not create a
separate template like this:
search.tpl
----------
<HTML>
<HEAD>
<TITLE>Untitled Document</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
{include file="body.tpl"}
</BODY>
</HTML>
body.tpl
--------
<FORM NAME="form1" METHOD="post" ACTION="">
<INPUT TYPE="text" NAME="textfield" VALUE="{$Name}">
<INPUT TYPE="submit" NAME="Submit" VALUE="Search">
</FORM>
index.php
---------
$smarty = new Smarty;
$smarty->display('search.tpl');
or, closer to what you want (?):
search.tpl
----------
<HTML>
<HEAD>
<TITLE>Untitled Document</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
{$body}
</BODY>
</HTML>
body.tpl
--------
<FORM NAME="form1" METHOD="post" ACTION="">
<INPUT TYPE="text" NAME="textfield" VALUE="{$Name}">
<INPUT TYPE="submit" NAME="Submit" VALUE="Search">
</FORM>
index.php
---------
$smarty = new Smarty;
$body = $smarty->fetch('body.tpl');
$smarty->assign("body",$body);
$smarty->display("search.tpl");
WiL Laxa wrote:
>
> Question:
>
> I have a template like this: search.htm
>
> <HTML>
> <HEAD>
> <TITLE>Untitled Document</TITLE>
> <META HTTP-EQUIV="Content-Type" CONTENT="text/html;
> charset=iso-8859-1">
> </HEAD>
> <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
> {capture name=body}
> <FORM NAME="form1" METHOD="post" ACTION="">
> <INPUT TYPE="text" NAME="textfield" VALUE="{$Name}">
> <INPUT TYPE="submit" NAME="Submit" VALUE="Search">
> </FORM>
> {/capture}
> </BODY>
> </HTML>
>
> Can I caputure "body" on my script
> Script:
> <?
> $smarty = new Smarty;
> $smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill");
> $body = $smarty->fetch('search.htm');
> ?>
>
> But i don't want to get the whole template... just the {capture} 'body'
> part. And use that to place on my site template.
>
> <?
> $smarty->clear_all_assign();
> $smarty->assign("Body",$body);
> $smarty->display('template.htm');
> ?>
>
> Is it possible to do that?
>
> WiL
>
> ---
> You are currently subscribed to smarty as: wlaxa@blendermedia.com
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Monte Ohrt <monte@ispi.net>
Director of Technology, ispi Inc.