Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter appomatix

    (@appomatix)

    @bcworkz Thanks! I still have to do a little digging because the theme builder I’m using talks about custom dynamic fields and populating them from a database, but I haven’t yet found where they actually show, in code, how to do it. It may just be a matter of the theme providing the ability to establish the custom fields within the page and using plain PHP to populate them. We’ll see.

    Thread Starter appomatix

    (@appomatix)

    Thanks @bcworkz for the response. It’s actually a Postgres database, for various reasons. But whatever WordPress functionality I’m losing by it not being a MySQL (or MariaDB) database I don’t think will be an issue since all I’m doing is exactly how you describe it: making the connection to the db, fetching the data, and displaying on the page. Any inserts, updates, or deletes will happen behind the scenes and only by me, not any site users, utilizing phpPgAdmin.

    Since the page is essentially static, at least data-wise, once the page loads, it would seem as though I don’t need to incorporate javascript to do what I want to do. I just need to figure out how to take the PHP array of objects fetched from the database ($fictionbooks) and feed those rows/records/objects to the appropriate custom fields I’ve created within the theme I’m using, which are a part of, as you suggest, a custom page template, just one created using the tools of the theme rather than directly in WordPress.

    Thread Starter appomatix

    (@appomatix)

    UPDATE #1:

    Would the first step be taking $fictionbooks (rather than each $fictionbook) and converting it to a javascript array of objects using JSON with:

    <script>
        var fictionBooks = JSON.parse(<?php echo json_encode($fictionbooks); ?>);
        for (var i=0;i<fictionBooks.length;i++) {
            do_something(fictionBooks[i]);
        };
    </script>
    Thread Starter appomatix

    (@appomatix)

    @peterschulznl

    Thanks for the response and sorry for the delayed reply. As much as I would like to see if I could get the process as you describe it above to work, I don’t think I’m going to be able to. My WordPress host doesn’t support MariaDB, only MySQL and Postgres, and barely Postgres at that. So, in order to attempt to do it, is seems as though I would have to have a remote MaridDB hosted somewhere then try to connect through that. If so, it would add a layer of complexity to my site that I can’t at the moment justify. If things change in the near future, I will reevaluate because I’m always up for a challenge. ??

    Cheers!

Viewing 4 replies - 1 through 4 (of 4 total)