Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

New themes

edited October 2012 in Design

Hi

I want to create a new theme. Unfortunately, I never find the menu on the construction.

apps->navigation->handlers top.php

<?php

/**
 * Displays the top-level navigation as a bulleted list,
 * with `class="current"` added to the current page's
 * `<li>` element for custom styling.
 */

$res = $memcache->get ('_navigation_top');
if ($res) {
    echo str_replace (
        sprintf ('', $page->id),
        sprintf ('', $page->id),
        $res
    );
    return;
}

$n = new Navigation;

$out = '';
foreach ($n->tree as $item) {
    $out .= sprintf ('%s', $item->attr->id, $item->data);
}
$out .= '';

$memcache->set ('_navigation_top', $out);

echo str_replace (
    sprintf ('', $page->id),
    sprintf ('', $page->id),
    $out
);

?>

Drop-down menu would be the target!

                  {! navigation/top !}
       {! navigation/section?section=submenu !}
            

When I am ready to share with you and will be downloadable.

Comments

  • You may find the navigation/map handler a more useful start for generating a drop-down menu, since it already shows multiple levels. Let me know if you run into issues, or if I can help at all. Cheers!

  • Thanks for your help!

    I'm trying to create a drop-down menu

    {! navigation/top !}
    {! navigation/section?section=other !}

    I think the structure of the

     map.php

    was set up?

  • I just added a basic {! navigation/dropmenu !} handler to the built-in menu types. You can see the changes here:

    https://github.com/jbroadway/elefant/commit/b7037dbc8cbb649f047db86cd64945f7c34dde66

    Styling is fairly easy, just look at the apps/navigation/css/dropmenu.css and override the styles in your layout CSS file. Cheers!

  • If you add the

    {! navigation/dropmenu !}

    the menu and the page contents do not appear.

  • That's odd. If I replace {! navigation/top !} with {! navigation/dropmenu !} in the default layout, it works as expected here. Do you see anything in your error log or if you set debug=On in the Elefant config?

  • edited October 2012

    It was the first that I looked in debug mode.But it was turned on debug mode does not work the same way, only the header is displayed. Other content is not!

    However, if I change the presentation layer of the

    {! navigation/dropmenu !}

    ->

    {! navigation/top !}

    and then turn on debug mode I get this error message:

    ErrorException: Assigning the return value of new by reference is deprecated

    elefant_autoloader ()

    76/home/hype/public_html/lib/Autoloader.php

    74.         $res = glob ('apps/*/{models,lib}/' . $class . '.php', GLOB_BRACE);
    75.         if (is_array ($res) && count ($res) > 0) {
    76.             require_once ($res[0]);
    77.             return true;
    78.         }
  • Is there any more to the debug output? And which version of Elefant and PHP are you on?

  • Is there any more to the debug output? no more! Latest stable release: 1.2.2 PHP 5.3.x

  • Ah yes, the dropmenu handler used the Page::add_style() method that's new to 1.3.x. I just added navigation/dropmenu to the 1.2 branch as well, so it'll be available in the next 1.2 update. In advance of that, here's the commit for it:

    https://github.com/jbroadway/elefant/commit/8363904168d1ac7b207d41e194fc66572454f6e5

Sign In or Register to comment.