Menu

Navbar

Patrick Garske

Creates a navbar block and navbar brand element.

style - Style of the navbar-block. Valid options are light and dark

brand - The brand name (e.g. company or website name)

links_to - The URL that the user gets redirected to after having clicked the brand name. (Optional, use no_arg() when no redirect is wanted)


Creates a navbar element

element - Element to be created. Valid options are link, dropdown, search and lead_link.

links_to - The URL to be called when element is clicked or the return URL when element type is search

name - The Element's name

args - If element type is link, controls if element is active or not. Valid options are active and no_arg(). Contains the Dropdown elements when element type is dropdown or the return method for search. Valid options are get and post.


Aligns all new Elements created after this statement to the right of the navbar.


Finishes navbar-block.

Example Navbar

View Working Example

echo init_navbar("light", "Navbar", "#");
echo navbar_element("link","#","Home","active");
echo navbar_element("link","#","About Us",no_arg());
echo navbar_element("dropdown","#","Dropdown",dropdown_element("link", "#", "Link") . dropdown_element("divider", no_arg(), no_arg()) . dropdown_element("link", "#", "Link"));
echo navbar_swap_alignment();
echo navbar_element("search","#","Search","get");
echo navbar_finish();

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.