• 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

category template accessing topic from API

Scheduled Pinned Locked Moved Technical Support
apicategorytemplate
8 Posts 2 Posters 1.5k 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.
  • L Offline
    L Offline
    loopyNid
    wrote on last edited by loopyNid
    #1

    i am trying to get a topic name from the category termplate with subcategories.

    so i get from the api:

    {
       "cid" : 5 ,
       "name" : .......
       "........." : 
      .
      .
      .
      .
      "children" : [
          {
             "cid": 6 ,
             "name" : .........
             .
             .
             .
             .
             "posts" ; [
                {
                   "pid" : 9,
                   "timestamp" :.....
    

    when i try to access anything after posts (for example " children.posts.user.username")
    i get an empty space.
    is there a way to access this?

    thx in advance 😄

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

    What template code are you trying?

    1 Reply Last reply
    0
  • L Offline
    L Offline
    loopyNid
    wrote on last edited by
    #3

    right now i have
    <h1>{children.posts.pid}</h1>
    in the partials/category/subcategory.tpl
    i also tryed {children.posts.topic.slug} and nothing.
    i want to mention that {children.name} works but nothing inside posts.

    thx for the response

    1 Reply Last reply
    0
  • L Offline
    L Offline
    loopyNid
    wrote on last edited by
    #4

    i dont know if it has something to do with this but i am modifing material theme.

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

    I need more context than that. With what you have, you'd need these surrounding it somewhere in your template:

    <!-- BEGIN children -->
      <!-- BEGIN children.posts -->
        <h1>{children.posts.pid}</h1>
      <!-- END -->
    <!-- END -->
    
    1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    wrote on last edited by
    #6

    Alternatively, you might just try {children.posts.0.pid}

    1 Reply Last reply
    0
  • L Offline
    L Offline
    loopyNid
    wrote on last edited by
    #7

    thank you very much @PitaJ. ❤

    i think i havent fully understood the templating system.
    is the only resource on it this? is there abything else on this templating system?

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

    @loopynid here's a better resource: BenchpressJS docs

    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