Fw: A function like 'Fetch' but only grabs info inside a certain tag.

From: Date: Tue, 26 Feb 2002 15:02:18 +0000
Subject: Fw: A function like 'Fetch' but only grabs info inside a certain tag.
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2850@lists.php.net to get a copy of this message
Why not make a function like function getbody($file) { preg_match("/<body.*?>(.*?)</body>/is",join('' ,file($file)),$matches); return $matches[1]; } I dindt test, but I guess I write a fine-work preg. So, you dont need to call smarty to get the body... Suggestion: try learn regular expression. Atenciosamente, Roberto Bertó 51 32270599 51 91169628 ----- Original Message ----- > From: "WiL Laxa" <wlaxa@blendermedia.com> > To: <smarty@lists.ispi.net> > Sent: Monday, February 25, 2002 10:20 PM > Subject: [smarty] A function like 'Fetch' but only grabs info inside a > certain tag. > > > > 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: roberto@berto.net > > To unsubscribe send a blank email to $subst('Email.Unsub') > > Visit Smarty's homepage at > > http://www.phpinsider.com/php/code/Smarty/ > > > > >

« previous php.smarty.general (#2850) next »