|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Pro |
As an exercise on using the HUD merge engine language I re-wrote the Extra Fields HUD to learn the mechanics and reduce redundant code. I've discovered that the merge language is very limited and (as done in the FTP HUD) it might be easier (although less efficient depending on the data set) to use javascript to do any serious manipulation. So perhaps in the future we could get some Javascript bindings for more direct access?
This message has been edited. Last edited by: Andrew Migliore, |
||
|
|
Pro |
Okay obviously I am talking to myself and have nothing better to do!
Here is a slight re-write of my re-write without trying to be too clever. Again it shows you can create procedures to define reusable blocks. The recursive resolving of <$var$> nested in other vars is not clear. For example it doesn't appear to work with <$if$> constructs. But in the example you can see that nested variables resolve fine in the <$identify$> construct. Here it is. I hope someone finds this useful.
<$procedure showObject curModel curTitle curIcon curText$>
<a href="daylite://ShowObject/?Entity=<$curModel.entity.name$>&ID=<$curModel.primaryKeyValue$>" \
title="<$curTitle$>">
<$if curIcon$><img src="<$curIcon$>" align="bottom" class="icon" /><$endif$>
<$if curText$><$curText$><$endif$></a>
<$endprocedure$>
<$procedure outputExtraField curModel curValue$>
<$identify extraLabel=curModel.extraFieldsNames.extra<$curValue$>$>
<$identify defaultLabel="Extra Field <$curValue$>"$>
<$if extraLabel != defaultLabel$>
<tr>
<td width="20"><$call showObject curModel "Edit <$extraLabel$>" "field.tif" ""$></td>
<td><$extraLabel$></td>
<td><$curModel.extra<$curValue$>$></td>
</tr>
<$endif$>
<$endprocedure$>
<$procedure outputExtraDate curModel curValue$>
<$identify extraLabel=curModel.extraFieldsNames.extraDate<$curValue$>$>
<$identify defaultLabel="Extra Date <$curValue$>"$>
<$if extraLabel != defaultLabel$>
<tr>
<td width="20"><$call showObject curModel "Edit <$extraLabel$>" "date.tif" ""$></td>
<td><$extraLabel$></td>
<td><$curModel.extraDate<$curValue$>.shortDate$></td>
</tr>
<$endif$>
<$endprocedure$>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="dl_business.css" />
</head>
<body>
<table class="dl_business_table dl_business_normal">
<$loop value 1 12 1 loop1$>
<$call outputExtraField model value$>
<$endloop loop1$>
<$loop value 1 4 1 loop1$>
<$call outputExtraDate model value$>
<$endloop loop1$>
</table>
</body>
</html>
|
|||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|

