Log in | Register | Lost password

Bottom
Diferent menus, based on content category?
  • Posted: 05.06.2008, 07:23
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    I have a question, is there a way to have for example four menu blocks, and every one display only when dokument from specified category is displayed. Or something similar.. In pagesetter I can do this, because there is diferent publication type - Theme settings->Page configurations assignments->different ini file , but in Content Isn't pub. types.
  • Posted: 11.06.2008, 07:10
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    Hello sorry for my english :-D
    I have done little changes in Content/pnuserapi.php :

    Code

    if (substr($lastarg, strlen($lastarg)-strlen($suffix)) == $suffix) {

    for ($i=2; $i<$argsnum; $i++) {

    if (!empty($urlname))

    $urlname .= '/';

    $urlname .= $args['vars'][$i];

    }

    $urlname = substr($urlname, 0, -strlen($suffix));



    $pageId = pnModAPIFunc('content', 'page', 'solveURLPath', array('urlname' => $urlname));//new

    $category = pnModAPIFunc('content', 'page', 'GetPageCategory', $pageId);//new



    pnQueryStringSetVar('func', 'view');

    pnQueryStringSetVar('name', $urlname);

    pnQueryStringSetVar('pid', $pageId);//new

    pnQueryStringSetVar('cat', $category);//new

    return true;

    }

    lines commented //new are new or modified

    and I created new fuction in Content/pnpageapi.php:

    Code

    function content_pageapi_GetPageCategory($pageId) //new

    {

    $pntable = pnDBGetTables();

    $pageTable = $pntable['content_page'];

    $pageColumn = $pntable['content_page_column'];

    $pageId = (int)$pageId;



    $sql = "

    SELECT $pageColumn[categoryId]

    FROM $pageTable

    WHERE $pageColumn[id] = $pageId";



    $dbresult = DBUtil::executeSQL($sql);



    if ($result->EOF)

    return false;



    $category = '';

    for (; !$dbresult->EOF; $dbresult->MoveNext())

    {

    $category = (int)$dbresult->fields[0];

    }



    $dbresult->Close();



    return $category;



    }


    now is possible to use advanced block placement option in Block settings to distinguish which blocks will be displayed, based on content category or pid! On advanced block placement page, is neccesery to set function type=user, function=view and custom arguments: cat=xx or pid=xx. For example is possible to use more arguments: pid=1, pid=3, cat=5 etc.. And the block will display only if the dokument is in specified category or only for specified dokument 8-)
    This modification works only with short urls enabled!



    edited by: antz, Jun 11, 2008 - 08:13 AM
  • Posted: 11.06.2008, 18:04
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    Actually, you could do this using the Extended Menu block in PN 0.8 RC4 / Zikula 1.0. You can assign certain menu items to specific pages within your site. For an example of what I mean and how I used it, visit http://www.pdgroupllc.com -- take note of the menu then click on "Services" and you'll see new menu items appear.
  • Posted: 11.06.2008, 22:01
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0

    Wendell

    Actually, you could do this using the Extended Menu block in PN 0.8 RC4 / Zikula 1.0. You can assign certain menu items to specific pages within your site. For an example of what I mean and how I used it, visit http://www.pdgroupllc.com -- take note of the menu then click on "Services" and you'll see new menu items appear.


    Yes, It works, but only with short URLs disabled, because with short URLs enabled the returned argument is only content item name (not pid). The modification above, is the solution to do this with short URLs enabled.

Template courtesy of Designs By Darren.