Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 10257

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>udm_cat_path</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="mnoGoSearch Functions"
HREF="ref.mnogosearch.html"><LINK
REL="PREVIOUS"
TITLE="udm_cat_list"
HREF="function.udm-cat-list.html"><LINK
REL="NEXT"
TITLE="udm_check_charset"
HREF="function.udm-check-charset.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP 手册</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.udm-cat-list.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.udm-check-charset.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.udm-cat-path"
></A
>udm_cat_path</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN127158"
></A
><P
>    (PHP 4 &#62;= 4.0.6, PHP 5 &#60;= 5.0.4)</P
>udm_cat_path&nbsp;--&nbsp;Get the path to the current category</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN127161"
></A
><H2
>Description</H2
>array <B
CLASS="methodname"
>udm_cat_path</B
> ( resource agent, string category )<BR
></BR
><P
>&#13;    Returns an array describing the path in the categories tree from the tree
    root to the current one, specified by <CODE
CLASS="parameter"
>category</CODE
>.
    <CODE
CLASS="parameter"
>agent</CODE
> is the agent identifier returned by a previous
    call to <B
CLASS="function"
>&#62;udm_alloc_agent()</B
>.
   </P
><P
>&#13;    The returned array consists of pairs. Elements with even index numbers
    contain the category paths, odd elements contain the corresponding category
    names.
   </P
><P
>&#13;    For example, the call <TT
CLASS="literal"
>$array=udm_cat_path($agent, '02031D');</TT
> 
    may return the following array:
   <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="screen"
>$array[0] will contain ''
 $array[1] will contain 'Root'
 $array[2] will contain '02'
 $array[3] will contain 'Sport'
 $array[4] will contain '0203'
 $array[5] will contain 'Auto'
 $array[4] will contain '02031D'
 $array[5] will contain 'Ferrari'</PRE
></TD
></TR
></TABLE
>
   </P
><P
>&#13;    <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN127181"
></A
><P
><B
>例 1. 
      Specifying path to the current category in the following format: 
      '&#62; Root &#62; Sport &#62; Auto &#62; Ferrari'
     </B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php<br />&nbsp;&nbsp;$cat_path_arr </font><font color="#007700">= </font><font color="#0000BB">udm_cat_path</font><font color="#007700">(</font><font color="#0000BB">$udm_agent</font><font color="#007700">, </font><font color="#0000BB">$cat</font><font color="#007700">);<br />&nbsp;&nbsp;</font><font color="#0000BB">$cat_path </font><font color="#007700">= </font><font color="#DD0000">''</font><font color="#007700">;<br />&nbsp;&nbsp;for (</font><font color="#0000BB">$i</font><font color="#007700">=</font><font color="#0000BB">0</font><font color="#007700">; </font><font color="#0000BB">$i</font><font color="#007700">&lt;</font><font color="#0000BB">count</font><font color="#007700">(</font><font color="#0000BB">$cat_path_arr</font><font color="#007700">); </font><font color="#0000BB">$i</font><font color="#007700">+=</font><font color="#0000BB">2</font><font color="#007700">) {<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$path </font><font color="#007700">= </font><font color="#0000BB">$cat_path_arr</font><font color="#007700">[</font><font color="#0000BB">$i</font><font color="#007700">];<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$name </font><font color="#007700">= </font><font color="#0000BB">$cat_path_arr</font><font color="#007700">[</font><font color="#0000BB">$i</font><font color="#007700">+</font><font color="#0000BB">1</font><font color="#007700">];<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$cat_path </font><font color="#007700">.= </font><font color="#DD0000">" &gt; &lt;a href=</font><font color="#007700">\"</font><font color="#DD0000">$_SERVER</font><font color="#007700">[</font><font color="#DD0000">PHP_SELF</font><font color="#007700">]</font><font color="#DD0000">?cat=$path</font><font color="#007700">\"</font><font color="#DD0000">&gt;$name&lt;/a&gt; "</font><font color="#007700">;<br />&nbsp;&nbsp;}<br /></font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
   </P
><P
>&#13;    See also <A
HREF="function.udm-cat-list.html"
><B
CLASS="function"
>udm_cat_list()</B
></A
>.
   </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.udm-cat-list.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>起始页</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.udm-check-charset.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>udm_cat_list</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.mnogosearch.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>udm_check_charset</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>