mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-19 14:22:43 +08:00
127 lines
6.4 KiB
HTML
127 lines
6.4 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
|
<title>Get all the categories on the same level with the current one</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.udm-cat-list" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">udm_cat_list</h1>
|
|
<p class="verinfo">(PHP 4 >= 4.0.6, PHP 5 < 5.1.0, PECL mnogosearch >= 1.0.0)</p><p class="refpurpose"><span class="refname">udm_cat_list</span> — <span class="dc-title">Get all the categories on the same level with the current one</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="refsect1 description" id="refsect1-function.udm-cat-list-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>udm_cat_list</strong></span>
|
|
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$agent</code></span>
|
|
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$category</code></span>
|
|
) : <span class="type">array</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
Gets all the categories on the same level with the current one.
|
|
</p>
|
|
<p class="para">
|
|
The function can be useful for developing categories tree browser.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.udm-cat-list-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">agent</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
A link to Agent, received after call to
|
|
<span class="function"><a href="udm_alloc_agent.html" class="function">udm_alloc_agent()</a></span>.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">category</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.udm-cat-list-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
Returns an array listing all categories of the same level as the current
|
|
<code class="parameter">category</code> in the categories tree.
|
|
</p>
|
|
<p class="para">
|
|
The returned array consists of pairs. Elements with even index numbers
|
|
contain the category paths, odd elements contain the corresponding category
|
|
names.
|
|
</p>
|
|
<div class="example-contents screen">
|
|
<div class="returnvaluescode"><pre class="returnvaluescode">$array[0] will contain '020300'
|
|
$array[1] will contain 'Audi'
|
|
$array[2] will contain '020301'
|
|
$array[3] will contain 'BMW'
|
|
$array[4] will contain '020302'
|
|
$array[5] will contain 'Opel'
|
|
...
|
|
etc.</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.udm-cat-list-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
Following is an example of displaying links of the current level in format:
|
|
<div class="example-contents screen">
|
|
<div class="examplescode"><pre class="examplescode">Audi
|
|
BMW
|
|
Opel
|
|
...</pre>
|
|
</div>
|
|
</div>
|
|
<div class="example" id="zookeeper.exists.example.basic">
|
|
<p><strong>Example #1 <span class="function"><strong>udm_cat_list()</strong></span>example</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br /> $cat_list_arr </span><span style="color: #007700">= </span><span style="color: #0000BB">udm_cat_list</span><span style="color: #007700">(</span><span style="color: #0000BB">$udm_agent</span><span style="color: #007700">, </span><span style="color: #0000BB">$cat</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$cat_list </span><span style="color: #007700">= </span><span style="color: #DD0000">''</span><span style="color: #007700">;<br /> for (</span><span style="color: #0000BB">$i</span><span style="color: #007700">=</span><span style="color: #0000BB">0</span><span style="color: #007700">; </span><span style="color: #0000BB">$i</span><span style="color: #007700"><</span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #0000BB">$cat_list_arr</span><span style="color: #007700">); </span><span style="color: #0000BB">$i</span><span style="color: #007700">+=</span><span style="color: #0000BB">2</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">$path </span><span style="color: #007700">= </span><span style="color: #0000BB">$cat_list_arr</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">];<br /> </span><span style="color: #0000BB">$name </span><span style="color: #007700">= </span><span style="color: #0000BB">$cat_list_arr</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">+</span><span style="color: #0000BB">1</span><span style="color: #007700">];<br /> </span><span style="color: #0000BB">$cat_list </span><span style="color: #007700">.= </span><span style="color: #DD0000">"<a href=\"</span><span style="color: #0000BB">$_SERVER</span><span style="color: #007700">[</span><span style="color: #0000BB">PHP_SELF</span><span style="color: #007700">]</span><span style="color: #DD0000">?cat=</span><span style="color: #0000BB">$path</span><span style="color: #DD0000">\"></span><span style="color: #0000BB">$name</span><span style="color: #DD0000"></a><br />"</span><span style="color: #007700">;<br /> }<br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.udm-cat-list-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="udm_cat_path.html" class="function" rel="rdfs-seeAlso">udm_cat_path()</a> - Get the path to the current category</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
</div></div></div></body></html> |