[Typo3-dev] Suggestion for new parameter in HMENU: excludePidList

Michael Stucki mundaun at gmx.ch
Wed Oct 1 01:05:06 CEST 2003


Hello,

I was looking for an option to exclude a whole set of subpages to a page.
Since I still need the parent page (see below to know why) I had the idea
to add a new parameter that acts just like the excludeUidList but uses PIDs
(parent UID) instead.

Why I need this:
I am using a menu that has multiple levels but only shows the two of them.
But there is an exception for one page where the 3rd level will be
displayed additionally.
I could use excludeUidList but then I would need to list _any_ page on my
site manually. So my idea was to create the list of UIDs dynamically from a
list of PIDs.

This is my change to the code. All I did was to copy the commands that are
used for the "special = directory" option since this one fetches the parent
UIDs, as well.
After fetching such a UID, I just put each one in front of
$this->conf["excludeUidList"]:

===

tslib/class.tslib_menu.php:

Lines 500/1680: (it's twice the same code)

    // new option "excludePidList" (most parts are copied from
    // "case: directory" from above)
    if (trim($this->conf["excludePidList"]))        {
        $items=t3lib_div::intExplode(",",$this->conf["excludePidList"]);
        reset($items);
        while(list(,$id)=each($items))  {
            $idPage = $GLOBALS["TSFE"]->sys_page->getRawRecord("pages",$id);
            if (is_array($idPage) && \
              $GLOBALS["TYPO3_CONF_VARS"]["FE"]["enable_mount_pids"] && \
              $idPage["mount_pid"]>0)  {
                $MP=$idPage["mount_pid"]."-".$idPage["uid"];
                $id=$idPage["mount_pid"];
            } else $MP=0;

            $query = $GLOBALS["TSFE"]->cObj->getQuery("pages", \
                       Array("pidInList"=>$id,"orderBy"=>$altSortField));
            $res = mysql(TYPO3_db, $query);
            while ($row = mysql_fetch_assoc($res))      {
                $this->conf["excludeUidList"] = $row["uid"] . "," . \
                  $this->conf["excludeUidList"];
            }
        }
    }

===

I feel that this code is not perfect. But hey guys - it's the first
modification I've made to that source code ever! :-)

I have two more questions left:
- How can that code be improved?
- Is there any need to (or will Kasper) include this option into the source?

Thanks for any help! :-)
- michael
-- 
Want support? Please read the list rules first: http://typo3.org/1438.0.html




More information about the TYPO3-dev mailing list