Created by @fvottus in Q&As
@fvottus
@fvottus

Hi, I'm kinda stupid in these things, I never worked with Nittro and I'm new to web development.

Anyways, I added the nittro js & css to my @layout.latte and when I try to click on some <a> link, it just doesn't work. It redirects to that URL but shows the old content.

I'm missing something here.

Btw. I do extend the BasePresenter to Nittro\Bridges\NittroUI\Presenter.

@jahudka
@jahudka

Hi, and did you add some snippets to your @layout.latte? Basically as a starting point you can just wrap {include #content} in {snippet content}{/snippet}. If you have one or more snippets in your layout but they aren't called content you need to call $this->setDefaultSnippets([ /* names of snippets */ ]) in your base presenter's setup() method. If that doesn't point you in the right direction you'll need to open the browser's developer console and check if there are any errors reported, and also check the network request log to see what your app is sending in response to you clicking the link - it should be JSON, not HTML.

@fvottus
@fvottus

I didn't. Thank you for response, gonna try and reply.

@fvottus
@fvottus

Thank you very much, works now! :D I guess I'm dumb for not giving attention to details.

// Edit, it works, however, forms don't work. It says "There was an error processing your request. Please try again later." It created the section though.

https://ctrlv.cz/shots/2020/03/24/Pvza.png

// Edit 2, the login & create article forms work, only create section & register forms just doesn't work.

Code: https://pastebin.com/gR66AWsW

@jahudka
@jahudka

@fvottus a good place to check when debugging Nette+Nittro apps is the Network panel of your browser's Developer Tools. Open it first and then try submitting the form. A new request should appear; when it's finished, you can click on it to see some details. The fastest check you can make is to look at the response from the server: if it's your full page HTML with layout etc., then you didn't redraw any snippets. It must always be JSON.

Sign in to post a reply