Next:
Utah @  Baylor
ESPN+

Hierarchical view update – phoning a friend in India

Welcome to Ute Hub Forums Misc Hierarchical view update – phoning a friend in India

Viewing 3 reply threads
  • Author
    Posts
    • #22871
      6
      Tony (admin)
      Keymaster

      I’ve spent literally days working on the post threading for the home page.  You know, indenting replies and reordering them to show who is replying to who.   I’ve come very close in a few different ways to getting it to work right.  Normally in a regular site/app that I created myself I could have made the changes fairly easily, but because of the site engine and plugins I’m using to create the forum, I’m stuck in their system.  This made this task astoundingly complicated.

      I finally realized I had run up against either a limitation in my cranium, or a limitation in the site’s foundation. Assuming the problem is inside my cranium, I decided I would try out hiring a developer from India to get a different set of brain cells on this.Hopefully I’ll have some progress in the next 2-3 days.

      I’m bummed that I’ve finally come up against a code thing that I seemingly couldn’t overpower by sheer time and/or will power. First time. But I can’t waste days being stuck on something like this.  Better off getting a fresh set of brain cells on it and see what happens.

      Cheers and GO UTES.

    • #22880
      4
      jamarcus24
      Participant

      We believe in you, Tony.

       

    • #22882
      1
      96GradAlum
      Member

      You need to use recurssion.  This way you can indent in an unlimited way – without having to know how many children each post has.  Does that make sense.  I’ve written these before but it’s been quite a while.  It’s a very uncommon technique but it works perfectly for this situation.  Ask you developer if he has ever done a recursive loop.  If not tell him that’s the solution to the problem. He’ll be able to find examples in PHP on the web.

      I did some poking around and it looks like your site (or the platform for your site) is written in PHP.  Is this correct?  I’ve never coded in PHP but it’s not that harry since it’s a scripting language.

       

      PS I’m really impressed that you’re willing to hire someone to work on it.  That is awesome.  Shows a serious level of commitment.

      • #22883
        3
        Tony (admin)
        Keymaster

        Yes @96GradAlum I’ve actually mucked around with some recursion loops.  I can get recursion to work for cotent pages here, but not forum replies because the database structure is different.  Yes it is PHP based on the WordPress CMS.  That’s what’s making it a pain in the ass.  If I wrote the forum myself in PHP I’d be done, but having to jump through their hoops is the problem.  I’m considering rewriting the whole site to get out of the WP sphere, but it does allow me to do other things easily and quickly.

        • #22885
          2
          96GradAlum
          Member

          Lol … OK … now that I know you’re technical I’ll stop talking down to you.  Sorry 🙂

      • #22884
        96GradAlum
        Member

        Oh btw what I said above is only true if the database supports it.   I suspect it does though.  What I mean by that is that each child post has a reference to it’s parent.  If it only has a refernce to the main post (that started the thread) then you’re screwed and no coding technique will solve the indenting problem.  

         

        Hopefully my explination makes sense.  It’s hard to talk technical with someone if they don’t have at least some background in it 🙂

        • #22889
          Tony (admin)
          Keymaster

          There is a reference to the parent in the database, and not in a related table which should make it easier.  I can do recursion for a different post type than a reply and I got it to work.  When I change the type to reply, it all ends up flat. The recursion doesn’t happen, it just loops in the first loop and doesn’t call itself. Does that make sense?  Probably a stupid simple reason that I’m missing.

          • #22893
            Daedalus
            Participant

            I’d offer some help with an example set of database records but it sounds like you’re seeking advice from someone you know.  If that fails, let me know and I’ll apply my finely U-of-U-training in algorithms to it (Comp. Sci. degree).  Or, you know, whatever.  🙂

            Vendor lock-down can be a pain even if it provides shortcuts.  Might do better with a more abstract toolkit, but that’s a helluva lot of work.

            • #22894
              Tony (admin)
              Keymaster

              Actually I don’t know them. Just went through a site to hire developers.  Thanks @daedalus.  I’m happy to post a small example mysql table if you want to play with it.  The catch is that the site CMS does a “pre query” which does all that ordering and such, then I’m using vendor specific functions to render stuff like the reply content, avatars, etc.  So if I go without that pre-query and vendor specific stuff I’ll have to rewrite a pile of code for all the reply content and layout.  

          • #22895
            Tony (admin)
            Keymaster

            Wait I was wrong.  The parent for a reply is stored in a meta table, not the main table. Boo.  So yeah now I remember.  I did a mysql join of the main table and the meta table but there’s strangeness in the db structure.  The meta table stores a “reply_to” key, which is the id of the parent of a reply to a reply.  BUT if one replies to the main topic, there is NO reply to meta key.  There is still the main topic parent however, which is stored in the main table.

            So if one replies to the main topic, the main table parent field “post_parent” contains the parent, and if one replies to a reply, the meta table reply_to meta key stores the parent.  

            If every entry, reply or topic, shared the same parent field it would be far easier.  That’s why I’ve been trying to do a join of the two tables, then iterate through the recursive loop.  But my query is not right.  

            BLA.

            • #22899
              Daedalus
              Participant

              so maybe a left join between the two tables that allows null reply_to values, then return as the column “parent” the value “ifnull(reply_to, post_parent)”.  I can probably expand that, but I’m allegedly supposed to be working on my own code at this hour.  😀

              • #22905
                Tony (admin)
                Keymaster

                so maybe a left join between the two tables that allows null reply_to values, then return as the column “parent” the value “ifnull(reply_to, post_parent)”.  I can probably expand that, but I’m allegedly supposed to be working on my own code at this hour.  

                Wow I’ve been working on this and what you are saying makes sense. I seem to be moving close to what you are suggesting.

                Maybe I’m doing it bassackwards, but what I had done so far was doing query to get a count for reply_to.  If it was > 0, then I queried the meta table for the parent values, then used those values in a 2nd query against the post table.  Unbelievably IT WORKED.  I have recursion and replies.  The problem is yes, none of the first level replies show up, only replies to replies.  I was just contemplating a join (which I’m so-so at).  Currently it is an if statement:  if reply_to > 0 then do the query above, else do the regular flat query from the post_parent.

                I’ll look at the join more. One issue is that there can be multiple records in the reply_to with the same parent so I can’t do a 1-1 join between the meta and the post table.

    • #22901
      3
      leftyjace
      Participant

      So nice to know I’m not the only die hard geekmeister in this world that also loves Utah sports

      • #22903
        jrj84105
        Participant

        Even if it is ultimately doable is it permissible under the terms of agreement with WordPress?  

        Getting the threaded format out of one of these pre-fab products is like getting blood from a stone, and even if it’s pulled off, it may violate terms of agreement.  People are used to the threaded format of Utefans but unless someone commits to building, maintaining, updating, and supporting a made from scratch site with no external support, it’s probably not going to happen.

        I’d say that people should just get used to the idea of a more compartmentalized format, but as long as Utefans is around people will seem to hold strong to that threaded preference, even if UteHub does a lot of other things much better.

        • #22906
          1
          Tony (admin)
          Keymaster

          Even if it is ultimately doable is it permissible under the terms of agreement with WordPress?

          No worries on that. It’s all open source, so one can hack it to one’s content. 

          • #22912
            jrj84105
            Participant

            That’s awesome. I think if you pull that off, it will definitely satisfy a large contingent of current and future users.

            • #22913
              Tony (admin)
              Keymaster

              That’s awesome. I think if you pull that off, it will definitely satisfy a large contingent of current and future users.

              It will be pulled off, one way or another.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.