if (!empty($_SERVER['HTTP_CLIENT_IP']))
$ip=$_SERVER['HTTP_CLIENT_IP'];
else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
else
$ip=$_SERVER['REMOTE_ADDR'];
?>
As demonstrated, we use the @ sign to locate widgets with a matching name and use the $ sign to seek the widget with matching IDs, for example:
jq(‘@window > $abc’) will return the two div(id=abc) elements.
jq(‘@window[class~=”abc”] @div’) will only return the div where is inside the window with “abc” CSS class name.
jq(‘div$win1 > $abc’) will return the div element where is inside the win1 window.
jq(‘$abc’) will return all the elements that match from the given id.
jq(‘@div’) will return all the elements that match from the given tag name.
jq(‘@window:first’) will return id=”win1″
jq(‘@window[border=”normal]”‘) will return id=”win1″.
Note that you can use CSS and ZK selectors together. For example, jq(“@window > div”) will return the Div element which is under the window widget.
Summary
The ZK selector is excellent for optimizing applications at the client. The concept of ZK selector was introduced to enable automatic testing without needed a UUID as we can use ZK selectors to identify ZK components. This was implemented by our testing technology ZTL. Most applications change their code in the future, but they don’t want to re-code test each time the software changes. That is why we enhanced the selector to work with ZK, because the selector is more relative than UUID in testing code.
Would you mind posting the source code for the interactive demo link please? It would sure help me understand how to use your examples correctly.
Thank you!
Very Cool!
I would also like to see the source code
Please see here – https://zk1.svn.sourceforge.net/svnroot/zk1/releases/5.0.2/zkdemo/src/archive/test/selector.zul