• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.1 Latest
Buy Hosting

Please I need some help with modifying nodebb (themes/plugins).

Scheduled Pinned Locked Moved NodeBB Development
12 Posts 2 Posters 863 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • AzurepulseA Offline
    AzurepulseA Offline
    Azurepulse
    wrote on last edited by
    #1
    Hi I'm a beginner and I'd like to create a forum with nodebb.

    Though nodebb is great but I need some major changes,and I 'm getting more and more confused. The documents needs to be more specific.
    . e.g I 'd like a new hompage,and some other functions (an exam system).

    • Do I need to develop a new theme for that? or a new plugin?

    • If I want to add some new pages to it,should I just create some tpl files?

    • What do I do to connect these tpl files? Register them in Router.js file?
      e.g. I'd like to modify categories(which is the default home page for nodebb),but I don't see any in dir "views". I found one named "categories.tpl" in dir "build ".But can I modify it?Aren't those files in dir "build" automatically built by "build" command?
      😢 I'm quite lost.Could anyone just give me hint or something? Thanks.

    1 Reply Last reply
    1
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    wrote on last edited by
    #2

    You can probably use a combination of nodebb-plugin-custom-pages and nodebb-plugin-customize.

    AzurepulseA 1 Reply Last reply
    0
  • AzurepulseA Offline
    AzurepulseA Offline
    Azurepulse
    replied to PitaJ on last edited by
    #3

    @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?

    1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    wrote on last edited by
    #4

    You probably want to look at nodebb-plugin-quickstart

    AzurepulseA 1 Reply Last reply
    0
  • AzurepulseA Offline
    AzurepulseA Offline
    Azurepulse
    replied to PitaJ on last edited by
    #5

    @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?

    1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    wrote on last edited by PitaJ
    #6

    categories.tpl is provided by whatever theme you're using. For a default install and this site, that is under nodebb-theme-persona/templates/categories.tpl. That template is used as the source for constructing the templates you see under build/

    AzurepulseA 1 Reply Last reply
    0
  • AzurepulseA Offline
    AzurepulseA Offline
    Azurepulse
    replied to PitaJ on last edited by
    #7

    @PitaJ Indeed...Thanks a lot.
    I'm still having trouble making my new pages. Neither adding params.router.get('/myentrance',renderEntrance()); in theme.init function or adding router.get('/myentrance', controllers.user.getCurrentUser); works.
    What do I have to do to register a url in router?

    1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    wrote on last edited by
    #8

    You should have renderEntrance not renderEntrance(). Additionally you must register the API route or it will only work on cold load.

    What do you see when you go to /myentrance

    AzurepulseA 1 Reply Last reply
    0
  • AzurepulseA Offline
    AzurepulseA Offline
    Azurepulse
    replied to PitaJ on last edited by
    #9

    @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 register params.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.👍

    1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    wrote on last edited by
    #10

    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.

    AzurepulseA 1 Reply Last reply
    0
  • AzurepulseA Offline
    AzurepulseA Offline
    Azurepulse
    replied to PitaJ on last edited by
    #11

    @PitaJ Hi,sorry to bother you,but I ran into some errors.
    I set up a new page,registered it with params.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 says Uncaught 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.

    1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    wrote on last edited by
    #12

    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);
    

    https://github.com/pitaj/nodebb-plugin-calendar/blob/1.0.x/src/lib/controllers.js#L109-L110

    1 Reply Last reply
    1

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development