Custom pages break


  • GNU/Linux

    I have correctly setup a custom page (playark.it/arkmap) but every day I have to create it again because it breaks...

    Internal error.
    Oops! Looks like something went wrong!
    /arkmap
    Failed to lookup view "arkmap" in views directory "/home/www/node/playark/nodebb/public/templates"
    

    What's the problem?


  • Admin

    I don't get what you mean by "every day"? Also what version of nodebb / plugin version?


  • GNU/Linux

    happens when I use it with v0.7.0 stable



  • Do you copy the .tpl file when you are creating a custom page ? Where ?


  • GNU/Linux

    With "every day" I mean that every X hours it breaks (probably after reloads, restarts, new plugins etc).

    I have created an empty .tpl using touch


  • GNU/Linux

    @Fez-Vrasta said:

    With "every day" I mean that every X hours it breaks (probably after reloads, restarts, new plugins etc).

    I have created an empty .tpl using touch

    just noticed it comes back after a while, sounds like clashing with something else :eyes:

    EDIT: just disable in ACP -> GENERAL -> Navigation block.

    Enable it again later.. test it after a while. comes back, then enable it again in NAvigation again.

    strange



  • @Fez-Vrasta said:

    With "every day" I mean that every X hours it breaks (probably after reloads, restarts, new plugins etc).

    I have created an empty .tpl using touch

    well, If you are creating a .tpl file in "public" folder it'll be deleted after some time. Use your theme folder instead.


  • GNU/Linux

    @leksar why should a tpl created inside public folder get deleted automatically?



  • I'm not sure about "automatically", but forum restarting or even reloading will refresh your public/templates folder for sure.


  • GNU/Linux

    I still don't get why should it happens...



  • Why shouldn't ? Public folder is just a representation of the current settings. It's like compiled program, if i understatnd correctly. All the settings behind the scenes.


  • GNU/Linux

    so they should have called it dist...

    And inside it you should see only compiled sources. .tpl files are not compiled so they shouldn't be there.

    Also, I have placed a background image in that folder and it never been removed.



  • dunno.jpeg


  • Community Rep

    What exactly are you doing code-wise to set up the custom page?


  • Community Rep

    @Fez-Vrasta said:

    so they should have called it dist...

    And inside it you should see only compiled sources. .tpl files are not compiled so they shouldn't be there.

    Also, I have placed a background image in that folder and it never been removed.

    It's not really compiled in the traditional sense, nodejs (JavaScript as a whole) is an interpreted language. What is stored in the public folder are templates that are assembled at startup depending on your theme choices, etc. so if you put some change in the tpl file it will get overwritten. The templates are then used by client-side parsers to render the content for the user.

    If you're trying to make changes to something in a tpl file, you have to modify the theme directly.


  • GNU/Linux

    @BDHarrington7 said:

    @Fez-Vrasta said:

    so they should have called it dist...

    And inside it you should see only compiled sources. .tpl files are not compiled so they shouldn't be there.

    Also, I have placed a background image in that folder and it never been removed.

    It's not really compiled in the traditional sense, nodejs (JavaScript as a whole) is an interpreted language. What is stored in the public folder are templates that are assembled at startup depending on your theme choices, etc. so if you put some change in the tpl file it will get overwritten. The templates are then used by client-side parsers to render the content for the user.

    If you're trying to make changes to something in a tpl file, you have to modify the theme directly.

    I'm a JavaScript developer (I work with Ember.js and stuff like that) so I know how it works.
    The problem is that if you want to use the public folder to provide only compiled stuff then the templates should be compiled as well (aka, JS files and not TPL files anymore)

    Something similar to what happens with handlebars: http://handlebarsjs.com/precompilation.html

    @yariplus I just setup the custom menu item and then I use the custom pages plugin to show the custom page.


  • Community Rep

    IIRC the templating system is hand-rolled, I'm not sure what decisions were made around that and why. @psychobunny is the one you would want to discuss the architecture of that system with.


  • Community Rep

    @Fez-Vrasta Hey

    It sounds like you may be misunderstanding what the custom-pages plugin does. (I assume that's the one you are using.)

    You should not be creating a page for it route too. You are meant to add HTML widgets to the page on the Widgets panel. Then whenever you restart, it compiles that page for you.


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.