xoops forums

phillipd

Quite a regular
Posted on: 2005/3/18 19:39
phillipd
phillipd (Show more)
Quite a regular
Posts: 219
Since: 2004/4/20
#1

What does <{$searchform.javascript}> do?

I'm looking at some sample code in the xoops_members module and in one of the template files, xoopsmembers_searchform.html, there is the following code:

What exactly does the first line do? Please be very verbose.

<{$searchform.javascript}> <== This line, what does it do?
<b><{$searchform.title}></b>
<br /><br />
<form name="<{$searchform.name}>" action="<{$searchform.action}>" method="<{$searchform.method}>" <{$searchform.extra}>>
<table class="outer" cellpadding="4" cellspacing="1">
<!-- start of form elements loop -->
<{foreach item=element from=$searchform.elements}>
<{if $element.hidden != true}>
<tr>
<td class="head"><b><{$element.caption}></b></td>
<td class="<{cycle values="even,odd"}>"><{$element.body}></td>
</tr>
<{else}>
<{$element.body}>
<{/if}>
<{/foreach}>
<!-- end of form elements loop -->
</table>
</form>

fatman

Friend of XOOPS
Posted on: 2005/3/18 20:46
fatman
fatman (Show more)
Friend of XOOPS
Posts: 176
Since: 2003/12/13
#2

Re: What does do?

<{$searchform.javascript}> is a Smarty tag.

Somewhere in the module PHP script which loads that form the developer is using the XoopsForm class to build all the form fields and form details. This XoopsForm was assigned to Smarty using the name 'searchform'.

All of the <{$searchform.something}> tags hold some sort of details about the form. <{$searchform.javascript}> will likely include any javascript the developer is using with thier form (most likely for validation).

If you look at the HTML source of the actual page when loaded in XOOPs you'll see that in place of <{$searchform.javascript}> there will probably be a chunk of javascript code.

Hope thats the answer you're looking for.