mshallop pro asked 6 years ago

Can someone point me in the direction of a decent navbar tutorial?  I need something a little meatier than what I'm seeing here on the site or via google-search....

I'm not a f/e dev - although I've written some mdb apps (python) as recent as a year ago - mostly I do b/e db I thought I'd use the MDB lib in some PHP7 utilities but got stuck on the heavy-lifting bits.

So, I need something pretty damn basic that explains what javascript to use to power up/init the nav bar widget, and then how to process the events they spawn...

mdb is all that and bag of chips... it's hella-easy to code the pretty parts but I need a little bit of nudge to point me to some resource on how to make it, there's an example on the side-navbar for the js you have to call to initiate it... but there's nothing (on this site) that shows/demos how to do it for a top navbar...



Ollie Vincent pro commented 6 years ago

Hi, Can you confirm exactly what you are after (in simpler terms) and confirm what language you are using eg: Angular, React or JQuery. Thanks

mshallop pro commented 6 years ago

Yes, and thank you for being patient. I'm working just as hard to figure-out what question to ask as I am trying to accomplish the task I'm asking about... I am working with MDB Pro 4.5.5, I believe, using JQuery. The goal is to replace a 2004-era single-page PHP script with a 2018 single-page PHP script. In the old script, I just had links in a fieldSet that self-posted with the option/command (<a href='?admin=someCommand'...) allowing the PHP side of the script to make db queries and morp the output into html for display. In the new MDB version, I am using a top navbar (from the examples) with a form-enabled search-box embedded. I'm ok with the form and search box. What's baffling me is how to process the onclick event for the navbar menu items s.t. it posts the command back to itself. I remember, from the python app last year, that I had a side navbar and I had to init that widget with some javascript but that was probably the stuffs that controlled the navbar viz and placement (active paging, I think you call it.) and so isn't necessary for the top navbar version. I can suss out the javascript -- where I'm lost is where/how the javascript is embedded to handle the navbar click event(s) or how to self-post, using the href member in the tag. None of the examples here show how to implement this. I know this is webdev 101 stuff, but, like said in the original post, I'm a b/e dev and the pretty stuff that users see is just wizardry to me so, without examples that combine the presentation (exists) with some code examples that shows how you hook the event processing into the HTML, I'm stuck.... and I'm fairly sure that because I don't know how to phrase this request into a coherent search phrase, I keep getting rabbit-holed with the results. Hope that explains the issue better... I know this isn't a MDB issue per se, I was just rooting around looking for an in-depth example that included post-processing. Thanks, again, for listening.... ---mike

Ollie Vincent pro commented 6 years ago

Hi, Apologies for not giving a quick solution - but are you using flat PHP files (so you can put HTML in them) or are you using some kind of CMS?

mshallop pro commented 6 years ago

Just PHP files. This is a stand-alone, self-posting, script with both dynamically-generated and static HTML.

Ollie Vincent pro commented 6 years ago

Hi, Sorry - PHP isn't exactly my language so I am going to be a bit vague. By the sounds of it you are trying to rebuild the MDB navbar in PHP and clicking on the links isn't working correctly, but why not paste the html code into a separate PHP file , and then use PHP Includes? Then you can put all your PHP code for your forms in the same file

mshallop pro commented 6 years ago

No, actually, the basic page layout is pure html/css.... the content is generated on page load -- if there's no POST, then the landing page is invoked. So the MDB navbar is as-is in the examples as pure HTML outside of the PHP blocks.

Ollie Vincent pro commented 6 years ago

Ah, ok - Could you post your code below or show an example of what is happening? It's always easier to work with code or visualise an example. Thanks

mshallop pro commented 6 years ago

Hi - Thanks for the help but I just decided to bail on the js/ajax stuffs and wrap the left-side navbar in a form and process the events the old-fashioned way. There's a reason why I'm not a f/e dev. ;) ---mike


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No