• 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.2 Latest
Buy Hosting

How to add a new route

Scheduled Pinned Locked Moved NodeBB Development
9 Posts 3 Posters 2.4k 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.
  • J Offline
    J Offline
    joncodo
    wrote on last edited by
    #1

    I want to add another page for custom stuff.

    I want it to be at localhost:4567/iframe

    Where can I add this route so I can navigate to it by visiting that url.

    I want it to contain just the menu and an iframe to another site I own.

    Thanks in advance!

    1 Reply Last reply
    0
  • JasperNLJ Offline
    JasperNLJ Offline
    JasperNL Gamers
    wrote on last edited by
    #2

    Do you want a redirect to that page or do you want to keep the navigation bar?

    In the first case: on the ACP you can change the navigation bar.

    In the second case: there is a plugin that provides custom routes. I don't know the name but i can look it up!

    1 Reply Last reply
    2
  • yariplusY Offline
    yariplusY Offline
    yariplus Community Rep
    wrote on last edited by
    #3

    nodebb-plugin-custom-pages will work. It creates blank page routes with widget areas. You would use the Widgets ACP to insert an HTML widget on your new page and add the iframe there.

    1 Reply Last reply
    2
  • J Offline
    J Offline
    joncodo
    wrote on last edited by
    #4

    What is the ACP?

    1 Reply Last reply
    0
  • J Offline
    J Offline
    joncodo
    wrote on last edited by
    #5

    Ah, ACP = 'Admin Control Panel'?

    yariplusY 1 Reply Last reply
    0
  • yariplusY Offline
    yariplusY Offline
    yariplus Community Rep
    replied to joncodo on last edited by yariplus
    #6

    @joncodo yes 🙂

    1 Reply Last reply
    1
  • J Offline
    J Offline
    joncodo
    wrote on last edited by
    #7

    So that kind of works for me. I am now trying to make it look seemless. But the .container class has a margin and padding. I'm trying this hack to get it to work.

    <iframe id="iframe-content-bsft" class="iframe-content-bsft" src="http://localhost:1360" style="border: 0;"></iframe>
    <script type="text/javascript">

    var left = $('.container:has(.iframe-content-bsft)').css("margin-left"); //"88px"
    var leftNum = Number(left.split('px')[0]);
    var top = $('.container:has(.iframe-content-bsft)').css("padding-top"); //"15px"
    var topNum = Number(top.split('px')[0]);
    var width = $('.container:has(.iframe-content-bsft)').width(); //1170
    var widthNum = Number(width.split('px')[0]);

    var totalWidth = widthNum + leftNum * 2;

    $('#iframe-content-bsft').css("margin-left", "-" + left)
    $('#iframe-content-bsft').css("margin-top", "-" + top)
    $('#iframe-content-bsft').css("width", totalWidth + "px")

    </script>

    If I run it in the chrome dev tools, it works perfect. But when I put it in the admin tool in manage plugins, the script seems to not work.

    Am I going about this the wrong way? Is there a better way to do this?

    1 Reply Last reply
    0
  • yariplusY Offline
    yariplusY Offline
    yariplus Community Rep
    wrote on last edited by
    #8

    Why are you not just setting a negative margin in the iframe style?

    1 Reply Last reply
    1
  • J Offline
    J Offline
    joncodo
    wrote on last edited by
    #9

    It is working now! Thanks guys! It was the variable name top. I changed it to _top and it works perfectly

    1 Reply Last reply
    0

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