Skip to:
Content
Pages
Categories
Search
Top
Bottom

Plugin: bbMenu 0.1 beta

  • Okay here it is, bbMenu 0.1 beta

    What does it do?

    It adds a menu to you bbPress site, which you can re-order yourself using drag and drop at the adminpage.

    I am releasing this beta in hope to get some help concerning these issues:

    1) I need some “better” way to store/ get the page-id comparison from the database. Currently, the script compares the page-id with ‘location’ from the database table. It’s only possible to add just 1 value to this, so if the page id = front-page it will return true and give the <a> an id= current and the link will be underlined.

    The thing is, I need to add more stuff cause now only the front page is id-ed as current as the forum link is active, while topic-page should return as current aswell, cause I want this page to be “under” the forum link as well.

    I’ve tried filling the location in the table like this: front-page || topic-page, but this will not work, cause the script will check front-page || topic-page = page-id instead of picking just one to see if it is the same as page-id.

    Hope I do make any sense, just check the script.

    2) In IE the underline doesn’t show. It works in all other browsers, don’t know why.

    To do:

    1) Use some hooks for the admin pages (need bbPress 0.80 to do this right)

    2) Be able to click the menu title in the menu (in the admin) to change it into what ever you like

    3) Some documentation so people (plugin builders) can add their own pages

    4) Use scriptaculous instead of the scripts I use now (more options)

    Download the beta:

    http://www.sourceskins.com/bbMenu-0.1.zip

Viewing 25 replies - 1 through 25 (of 45 total)
  • @bbolman

    Participant

    Nice

    Btw stubled on the BLIX theme from bbPress. It uses for each (I asked about this in some other posts) in it’s menu and could be the answer of my nr 1 problem.

    Some peace of code:

    foreach ($pages as $page) {

    $page_id = $page->ID;

    $page_title = $page->post_title;

    $page_name = $page->post_name;

    if ($page_name == "archives") {

    (is_page($page_id) || is_archive() || is_search() || is_single())?$selected = ' class="selected"':$selected='';

    echo "<li".$selected."><a href="".get_page_link($page_id)."">Archives</a></li>n";

    }

    Now to confert it to this plugin, have to change ‘location’ input to: is_archive() || is_search() etc. Going to play with this :)

    @bbolman

    Participant

    Forgot to say this before, but this looks really sweet.

    Got the for each working:

    <ul id="navlist">

    <?php $pages = get_bb_menu();

    if ($pages) {

    foreach ($pages as $page) {

    $page_id = $page->page;

    $page_item = $page->item;

    $page_location = $page->location;

    echo "<li><a href="".($page_id)."">".($page_item)."</a></li>n";

    }

    }

    ?>

    </ul>

    The problem is, how can I let it spit:

    <li><a <?php if (is_bb_search())

    {

    echo "id="current"";

    }?> href="$page_id">$page_item</a></li>

    And is_bb_search() is $page_location = $page->location;

    @ear1grey

    Member

    …only the front page is id-ed as current as the forum link is active, while topic-page should return as current aswell, cause I want this page to be “under” the forum link as well…

    <grimace />

    If you do that (a) your page won’t validate and (b) there’s no guarantee of how the browser will interpret the content because HTML4 and XHTML specs require that element ID is unique in a page.

    From HTML4 spec:

    “id ID #IMPLIED — document-wide unique id —

    class CDATA #IMPLIED — space-separated list of classes —

    Yet another reason to use class="current". Using classes and ID’s appropriately is important.

    @ear1grey

    Member

    So, I think now you’re getting the function name “is_bb_search” (among other function names) from the db and you want to execute it to know if a particular list item should be marked as current.

    If that’s the case then it’s what I described before, which is something like where the function name is defined in $rw["location"] so…

    ...

    $page_location = $page->location;

    $switch = eval("return ".$rw["location"]);

    $current = ($switch ? ' class="current"' : "");

    echo "<li $current><a href="$page_id">$page_item</a></li>";

    ...

    Yeah I know about the id/class thingy, but even WP uses id instead of class. So why do they do that?. Are they wrong too? Perhaps I will change it in the official release, I just want to have it working first :)

    @ear1grey

    Member

    Syntactically speaking: only if a page does not validate is it “wrong”.

    Semantically speaking: if a page uses id to encode semantic meaning then it is syntactically correct, but semantically naive (which for a “semantic personal publishing platform” is sub-optimal).

    There are possibly places where WP gets semantically wrong, but, a lot (possibly all) of this is down to theme and plugin designers who are often unaware of the semantic issues.

    Anyhow, your description in the opening post (two items returning “current” as their id) is something that will create a non-validating document, so it would be syntactically wrong.

    In summary: id is for addressing elements, class is for describing them.

    But then I will have <li class= > and They wont conflict?

    Btw the code you gave doesn’t work. They beta is the most stable I’ve got working correctly. So if you like to help me out, plz take a look at it. And yes the beta has the “wrong” id coding.

    @ear1grey

    Member

    I think your post may be corrupted: did you mean to say

    <li class= >

    ?

    @ear1grey

    Member

    if something “doesn’t work” then:

    1. if you have an error message, google it, it may be something trivial.
    2. if you can’t understand what you see on google, post the error message here, so the magical community mind can see it – the key benefit of the forum is that one person’s fix becomes a solution for every person who follows with similar problems.

    Quote I think your post may be corrupted: did you mean to say

    <li class= >

    ?

    Yes it got corrupted, <a class=> is what I ment.

    Btw to solve my ‘problem’ I am indeed going to use the switch thingy (read some more about it), so it will check some hardcoded “location” first and then check the db list. It’s kinda an ugly workaround, but normal users wont be bothered with this code anyway…

    Anyone has any ideas about the IE “bug” ??

    @chrishajer

    Participant

    Is there a demo of it somewhere? I have no need to install it, so I can’t see the IE underline problem.

    Does it have anything to do with the :hover pseudo class? That can only be applied to <a> elements in IE before version 7. Not sure if that’s what the problem is. A demo would be helpful for me to see it without installing it, if possible.

    More about the IE :hover pseudo class

    Same problem in IE 7, no underline there either. It only effects IE as far as I know…

    Got it running on my testsite:

    http://www.sourceskins.com/bbpress/

    @chrishajer

    Participant

    Null, I looked at your site. No underlines appear for me with IE7 either, whether hovering or not. So, I don’t think it’s the :hover pseudo class problem (and especially since the :hover is applied to <a> elements.

    It looks like the underline might be behind the #cleaner div in IE, where it’s on top of it in FF. Can you try making the #wrapper-menu taller and see if you can see underlines then? I am guessing they are there, just not visible since they’re behind the #cleaner div.

    Is there a tool comparable to the web developer extension for FF, on IE? I installed the IE Developer toolbar, but it does not give you the ability to modify the CSS and see the changes.

    Hi,

    Thanks for the suggestion. I will look into this and take out the cleaner div and look at the page in IE again. If it’s still not there, then it’s not the div. I’ll post my findings here as soon as I have tested this.

    Thx

    ps. I have no idea if there are any toolbars like FF, sorry.

    Even without the cleaner div it’s still not working in IE :(

    So it’s not the div…

    @ear1grey

    Member

    The first google result for “IE7 border-bottom” gives the answer to this.

    I got it to work in IE7 by…

    1. changing all references from id="current" to class="current" (because I refuse to write semantically wrong css :) )
    2. replacing #current with .current { display: block; BORDER-BOTTOM: #2e6e15 3px solid; }

    …… i have to work on my google search words :(

    -double post-

    @ear1grey

    Member

    That comes with bitter experience :)

    Once it’s working, it’s then a good time start thinking about integration. Since this is a plugin it will have to work with many themes, so for maximum flexibility you might want to switch from pixel based sizing to either percentages or ems so that everything is sized relative to the default font.

    Okay this IE fix works, but gives a little design problem. On mouseover the underline will appear, but this also effects the div it’s in. Just look at the | between Forums | Search. Move with you mouse over Search (or click it) and see the | grow. Would like to keep the bar where the links are in the same size as it is now (looks great).

    Any ideas?

    @ear1grey

    Member

    that’s because the underline changes the size of the anchor element. a simple solution is to create a transparent underline for the standard anchor element, then change the color when hovered.

    Well the IE bug is solved, now I have the other one left.

    Tried this:

    $current = ('topic-page' == get_bb_location() || $rw['location'] == get_bb_location()) ? ' id="current"' : '';

    I’ve added 'topic-page' == get_bb_location() || to it. It works partialy. If topic-page isn’t get_bb_location then it wil use $rw['location'] == get_bb_location(), but if topic-page IS get_bb_location then it will underline ALL links. I think cause it doesn’t know that it only needs to underline the Forums link. So how to fix this so when topic-page IS get_bb_location -> is current -> highlight Forums

    Thx

    @ear1grey

    Member

    I think I answered this earlier …

    $switch = eval("return ".$rw["location"]);

    … because $rw[“location”] is, I think, the name of a function which you’re pulling from the DB.

Viewing 25 replies - 1 through 25 (of 45 total)
  • You must be logged in to reply to this topic.
Skip to toolbar