Please I need some help with modifying nodebb (themes/plugins).
-
You can probably use a combination of nodebb-plugin-custom-pages and nodebb-plugin-customize.
-
@PitaJ Hi,u r the author of "nodebb-plugin-calendar" right? Very nice to meet u,I've been reading ur code but little progress by now.
I don't feel well about using "nodebb-plugin-custom-pages", that's for a landing page right? I need a whole new set including tpl and backend code(controller,database connection etc) . I don't see any files other than .tpl in dir build which gives me doubts.
Haven't used nodebb-plugin-customize before,but that's for translation?I 'd like to develop a new function which would need everything from inserting data into database to a new page.
e.g I'm using theme-slick as a starter, but what should I do other than making a new tpl if I want a page which would query some data from mongodb and insert them into the page?
Sorry the upload func is down. I'll use text instead.theme dir less lib templates(both admin & client) library.js plugin.js what should I do if I want to make a new tpl in client side? Where do I put controller?Do I need to keep anything else in mind?
-
You probably want to look at nodebb-plugin-quickstart
-
@PitaJ Already downloaded nodebb-plugin-quickstart and nodebb-theme-quickstart.
Please excuse me,I worked with Vue before,don't know much about node.js.
Perhaps I should look up documents on express to get a better understanding on nodebb?
One thing that confuses me the most is I never found categories.tpl which serves as the home page.Where is it? I can see that controller renders "categories"
res.render('categories', data)
.But the dir "categories" works as a service layer ,obviously not the one I'm looking for. There has to be a tpl file named "categories", and I can only find one in dir "build".
That's not the one I'm looking for,is it? -
categories.tpl
is provided by whatever theme you're using. For a default install and this site, that is undernodebb-theme-persona/templates/categories.tpl
. That template is used as the source for constructing the templates you see underbuild/
-
@PitaJ Indeed...Thanks a lot.
I'm still having trouble making my new pages. Neither addingparams.router.get('/myentrance',renderEntrance());
intheme.init
function or addingrouter.get('/myentrance', controllers.user.getCurrentUser);
works.
What do I have to do to register a url in router? -
You should have
renderEntrance
notrenderEntrance()
. Additionally you must register the API route or it will only work on cold load.What do you see when you go to
/myentrance
-
@PitaJ Thank u so much!! So the correct way is to register my new url as
router.get(url, middleware)
in src>routes>api.js ,and then registerparams.router.get(url,controller);
in nodebb-mytheme>lib>theme.js>theme.init = function(params, callback) {
I need to spend some time checking what do these middlewares do.May stumble into a few more errors after.Hopefully I can still go to u for advice. -
You don't need to edit any NodeBB core files to add a route in your theme. The quickstart plugin has working examples, follow those for how to add an API route.
-
@PitaJ Hi,sorry to bother you,but I ran into some errors.
I set up a new page,registered it withparams.router.get('/myentrance',renderEntrance)
.And I'd like to import the default header(with some modification later) so I placed these (<!-- IMPORT header.tpl -->
) on entrance.tpl. Then the page went down.The error on console saysUncaught SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at myentrance:12
The page shows only "Login" button and progress bar kept flashing.
I know I must've missed the data "header.tpl" needs,but what do I do to get these data? Looking forward to your reply,thanks. -
Your don't need the header in your template. You need to add it like this:
router.get('/calendar', middleware.buildHeader, renderPageHandler); router.get('/api/calendar', renderPageHandler);
nodebb-plugin-calendar/src/lib/controllers.js at 1.0.x · pitaj/nodebb-plugin-calendar
Fully-featured calendar plugin for NodeBB. Contribute to pitaj/nodebb-plugin-calendar development by creating an account on GitHub.
GitHub (github.com)