Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 6461

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!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 the path to the current category</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.udm-cat-list.html">udm_cat_list</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.udm-check-charset.html">udm_check_charset</a></div>
 <div class="up"><a href="ref.mnogosearch.html">mnoGoSearch Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.udm-cat-path" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">udm_cat_path</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5 &lt;= 5.0.5, PECL mnogosearch &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">udm_cat_path</span> &mdash; <span class="dc-title">Get the path to the current category</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.udm-cat-path-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">array</span> <span class="methodname"><strong>udm_cat_path</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>
   )</div>

  <p class="para rdfs-comment">
   Returns an array describing the path in the categories tree from the tree
   root to the current one, specified by <em><code class="parameter">category</code></em>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.udm-cat-path-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">agent</code></em></span>
     <dd>

      <p class="para">
       A link to Agent, received after call to
        <span class="function"><a href="function.udm-alloc-agent.html" class="function">udm_alloc_agent()</a></span>.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">category</code></em></span>
     <dd>

      <p class="para">
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.udm-cat-path-returnvalues">
  <h3 class="title">Return Values</h3>
  <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>
  <p class="para">
   For example, the call <em>$array=udm_cat_path($agent, &#039;02031D&#039;);</em>
   may return the following array:
  <div class="example-contents screen">
<div class="cdata"><pre>
 $array[0] will contain &#039;&#039;
 $array[1] will contain &#039;Root&#039;
 $array[2] will contain &#039;02&#039;
 $array[3] will contain &#039;Sport&#039;
 $array[4] will contain &#039;0203&#039;
 $array[5] will contain &#039;Auto&#039;
 $array[4] will contain &#039;02031D&#039;
 $array[5] will contain &#039;Ferrari&#039;
</pre></div>
  </div>
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.udm-cat-path-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-4703">
    <p><strong>Example #1 
     Specifying path to the current category in the following format:
     &#039;&gt; Root &gt; Sport &gt; Auto &gt; Ferrari&#039;
    </strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;$cat_path_arr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">udm_cat_path</span><span style="color: #007700">(</span><span style="color: #0000BB">$udm_agent</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$cat</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$cat_path&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">;<br />&nbsp;&nbsp;for&nbsp;(</span><span style="color: #0000BB">$i</span><span style="color: #007700">=</span><span style="color: #0000BB">0</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #0000BB">$cat_path_arr</span><span style="color: #007700">);&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">+=</span><span style="color: #0000BB">2</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$path&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$cat_path_arr</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">];<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$name&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$cat_path_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 />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$cat_path&nbsp;</span><span style="color: #007700">.=&nbsp;</span><span style="color: #DD0000">"&nbsp;&gt;&nbsp;&lt;a&nbsp;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">\"&gt;</span><span style="color: #0000BB">$name</span><span style="color: #DD0000">&lt;/a&gt;&nbsp;"</span><span style="color: #007700">;<br />&nbsp;&nbsp;}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.udm-cat-path-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.udm-cat-list.html" class="function" rel="rdfs-seeAlso">udm_cat_list()</a> - Get all the categories on the same level with the current one</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.udm-cat-list.html">udm_cat_list</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.udm-check-charset.html">udm_check_charset</a></div>
 <div class="up"><a href="ref.mnogosearch.html">mnoGoSearch Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>